1// Copyright 2025 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
45//! Types encoding trace point identifiers.
67use core::marker::PhantomData;
89/// A resource identifier that can be used as an argument for trace events.
10#[derive(Copy, Clone)]
11pub struct TraceResourceId<'a> {
12#[cfg_attr(not(target_os = "fuchsia"), allow(unused))]
13value: u64,
14 _marker: PhantomData<&'a ()>,
15}
1617impl<'a> TraceResourceId<'a> {
18/// Creates a new resource id with the given value.
19pub fn new(value: u64) -> Self {
20Self { value, _marker: PhantomData }
21 }
22}
2324#[cfg(target_os = "fuchsia")]
25impl<'a> fuchsia_trace::ArgValue for TraceResourceId<'a> {
26fn of<'x>(key: &'x str, value: Self) -> fuchsia_trace::Arg<'x>
27where
28Self: 'x,
29 {
30let Self { value, _marker } = value;
31 fuchsia_trace::ArgValue::of(key, value)
32 }
33}