Tue, 20 Feb 2024 12:33:16 -0500
Logarithmic logging base correction
0 | 1 | use std::marker::PhantomData; |
2 | ||
5 | 3 | /// Standard identifier for a [`Support`][super::support::Support] stored in a |
4 | /// [`BTImpl`][super::bt::BTImpl] as [`BTImpl::Data`][super::bt::BTImpl::Data]. | |
0 | 5 | #[derive(Debug)] |
6 | pub struct SupportId<S> { | |
7 | pub id : usize, | |
8 | _phantom : PhantomData<S> | |
9 | } | |
10 | ||
11 | // derive fails so need to do Copy and Clone manually | |
12 | ||
13 | impl<S> Clone for SupportId<S> { | |
14 | fn clone(&self) -> Self { | |
15 | SupportId { id : self.id, _phantom : PhantomData } | |
16 | } | |
17 | } | |
18 | ||
19 | impl<S> Copy for SupportId<S> {} | |
20 | ||
21 | impl<S> From<u32> for SupportId<S> { | |
22 | #[inline] | |
23 | fn from(id : u32) -> SupportId<S> { | |
24 | SupportId { id : id as usize, _phantom : PhantomData } | |
25 | } | |
26 | } | |
27 | ||
28 | impl<S> From<usize> for SupportId<S> { | |
29 | #[inline] | |
30 | fn from(id : usize) -> SupportId<S> { | |
31 | SupportId { id : id, _phantom : PhantomData } | |
32 | } | |
33 | } | |
34 | ||
35 | impl<S> Into<usize> for SupportId<S> { | |
36 | #[inline] | |
37 | fn into(self) -> usize { | |
38 | self.id | |
39 | } | |
40 | } | |
41 |