pub struct IdPrefix { /* private fields */ }Expand description
A shortened from of an Id.
This is meant for Human interaction.
Implementations§
Source§impl IdPrefix
impl IdPrefix
Sourcepub const REQUIRED_LENGTH: usize = 2usize
pub const REQUIRED_LENGTH: usize = 2usize
The number of required hex bytes in a prefix (i.e., a prefix must be at least this * 2 hex chars long.)
Sourcepub fn from_hex_bytes(input: &[u8]) -> Result<Self, Error>
pub fn from_hex_bytes(input: &[u8]) -> Result<Self, Error>
Construct an new IdPrefix from hex bytes.
§Errors
- If the
inputdoes not contain (Self::REQUIRED_LENGTH* 2) hex bytes. - If the
inputis longer than 64 hex chars.
This is probably not what you want.
Use Id::shorten to turn an Id
to it’s short form instead.
Sourcepub fn resolve<E: Entity + EntityRead>(
self,
repo: &Repository,
) -> Result<EntityId<E>, Error>
pub fn resolve<E: Entity + EntityRead>( self, repo: &Repository, ) -> Result<EntityId<E>, Error>
Sourcepub fn is_prefix_of(&self, id: Id) -> bool
pub fn is_prefix_of(&self, id: Id) -> bool
Check if this prefix is a prefix of the Id id.
Trait Implementations§
impl Copy for IdPrefix
Auto Trait Implementations§
impl Freeze for IdPrefix
impl RefUnwindSafe for IdPrefix
impl Send for IdPrefix
impl Sync for IdPrefix
impl Unpin for IdPrefix
impl UnwindSafe for IdPrefix
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