[−][src]Struct uhlc::ID
An identifier for an HLC (MAX_SIZE bytes maximum).
This struct has a constant memory size (holding internally a [u8; MAX_SIZE]
+ a usize
),
allowing allocations on the stack for better performances.
Examples
use uhlc::ID; let buf = [0x1a, 0x2b, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; let id = ID::new(3, buf); assert_eq!(id.size(), 3); assert_eq!(id.as_slice(), &[0x1a, 0x2b, 0x3c]); assert_eq!(id.to_string(), "1A2B3C".to_string());
use uhlc::ID; use uuid::Uuid; let id = ID::from(Uuid::new_v4()); assert_eq!(id.size(), 16);
Implementations
impl ID
[src]
pub const MAX_SIZE: usize
[src]
The maximum size of an ID in bytes: 16.
pub fn new(size: usize, id: [u8; 16]) -> ID
[src]
Create a new ID with the "size
" first bytes of "id
"
pub fn size(&self) -> usize
[src]
The size of this ID in bytes
pub fn as_slice(&self) -> &[u8]
[src]
This ID as a slice
Trait Implementations
impl Clone for ID
[src]
impl Debug for ID
[src]
impl Display for ID
[src]
impl Eq for ID
[src]
impl From<Uuid> for ID
[src]
impl FromStr for ID
[src]
type Err = ParseIDError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Hash for ID
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for ID
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<ID> for ID
[src]
impl PartialOrd<ID> for ID
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for ID
[src]
impl<'_> TryFrom<&'_ [u8]> for ID
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,