libdd_profiling/collections/identifiable/
string_id.rs

1// Copyright 2023-Present Datadog, Inc. https://www.datadoghq.com/
2// SPDX-License-Identifier: Apache-2.0
3
4use super::*;
5use libdd_profiling_protobuf::StringOffset;
6
7pub type StringId = StringOffset;
8
9impl Id for StringId {
10    type RawId = i64;
11
12    fn from_offset(inner: usize) -> Self {
13        #[allow(clippy::expect_used)]
14        Self::try_from(inner).expect("StringId to fit into a u32")
15    }
16
17    fn to_raw_id(&self) -> Self::RawId {
18        Self::RawId::from(self)
19    }
20}