pub struct BlockId<T: Copy + Hash + Eq> { /* private fields */ }
Expand description
Represents a specific, deterministic two-way mapping between u64
values and opaque IDs.
For BlockId<char>
, additional functionality is provided for mapping between u64
s and
String
s.
Implementations§
source§impl<T: Copy + Hash + Eq> BlockId<T>
impl<T: Copy + Hash + Eq> BlockId<T>
source§impl BlockId<char>
impl BlockId<char>
For the special case of BlockId<char>
, helper encoders/decoders that use strings
rather than vectors are provided.
sourcepub fn encode_string(&self, v: u64) -> Option<String>
pub fn encode_string(&self, v: u64) -> Option<String>
Encode a u64
into an opaque string.
sourcepub fn decode_string(&self, v: &str) -> Option<u64>
pub fn decode_string(&self, v: &str) -> Option<u64>
Decode a u64
from an opaque string.
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for BlockId<T>where T: RefUnwindSafe,
impl<T> Send for BlockId<T>where T: Send,
impl<T> Sync for BlockId<T>where T: Sync,
impl<T> Unpin for BlockId<T>where T: Unpin,
impl<T> UnwindSafe for BlockId<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more