pub struct Id { /* private fields */ }
Expand description
A human-readable Id
Must be valid UTF8 and must not contain whitespace or any RESERVED_CHARS
Implementations
sourceimpl Id
impl Id
sourcepub fn from_hash<T, U>(hash: GenericArray<T, U>) -> Id where
U: ArrayLength<T>,
GenericArray<T, U>: AsRef<[u8]>,
pub fn from_hash<T, U>(hash: GenericArray<T, U>) -> Id where
U: ArrayLength<T>,
GenericArray<T, U>: AsRef<[u8]>,
Construct an Id
from a hexadecimal string representation of a SHA-2 hash.
sourcepub fn starts_with(&self, prefix: &str) -> bool
pub fn starts_with(&self, prefix: &str) -> bool
Return true if this Id
begins with the specified string.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Id
impl<'de> Deserialize<'de> for Id
sourcefn deserialize<D>(
deserializer: D
) -> Result<Id, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Id, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Id> for TCPathBuf
impl From<Id> for TCPathBuf
sourcefn from(segment: PathSegment) -> TCPathBuf
fn from(segment: PathSegment) -> TCPathBuf
Converts to this type from the input type.
sourceimpl FromIterator<Id> for TCPathBuf
impl FromIterator<Id> for TCPathBuf
sourcefn from_iter<T: IntoIterator<Item = PathSegment>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = PathSegment>>(iter: T) -> Self
Creates a value from an iterator. Read more
sourceimpl FromStream for Id
impl FromStream for Id
sourceimpl<'a, D> Hash<D> for &'a Id where
D: Digest,
impl<'a, D> Hash<D> for &'a Id where
D: Digest,
sourcefn hash(self) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>
fn hash(self) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>
Compute the SHA-2 hash of this value
sourceimpl<D> Hash<D> for Id where
D: Digest,
impl<D> Hash<D> for Id where
D: Digest,
sourcefn hash(self) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>
fn hash(self) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>
Compute the SHA-2 hash of this value
sourceimpl<'en> IntoStream<'en> for Id
impl<'en> IntoStream<'en> for Id
sourceimpl Ord for Id
impl Ord for Id
sourceimpl PartialOrd<Id> for Id
impl PartialOrd<Id> for Id
sourcefn partial_cmp(&self, other: &Id) -> Option<Ordering>
fn partial_cmp(&self, other: &Id) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Serialize for Id
impl Serialize for Id
sourcefn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
sourceimpl TryCastFrom<String> for Id
impl TryCastFrom<String> for Id
sourcefn can_cast_from(id: &String) -> bool
fn can_cast_from(id: &String) -> bool
Test if value
can be cast into Self
.
sourcefn opt_cast_from(id: String) -> Option<Id>
fn opt_cast_from(id: String) -> Option<Id>
Returns Some(Self)
if the source value can be cast into Self
, otherwise None
.
sourcefn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
Returns Ok(Self)
if the source value can be cast into Self
, otherwise calls on_err
.
sourceimpl TryCastFrom<TCPathBuf> for Id
impl TryCastFrom<TCPathBuf> for Id
sourcefn can_cast_from(path: &TCPathBuf) -> bool
fn can_cast_from(path: &TCPathBuf) -> bool
Test if value
can be cast into Self
.
sourcefn opt_cast_from(path: TCPathBuf) -> Option<Id>
fn opt_cast_from(path: TCPathBuf) -> Option<Id>
Returns Some(Self)
if the source value can be cast into Self
, otherwise None
.
sourcefn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
Returns Ok(Self)
if the source value can be cast into Self
, otherwise calls on_err
.
impl Eq for Id
impl StructuralEq for Id
impl StructuralPartialEq for Id
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F> Match for F
impl<F> Match for F
sourcefn matches<T>(&self) -> bool where
T: TryCastFrom<Self>,
fn matches<T>(&self) -> bool where
T: TryCastFrom<Self>,
Returns true
if self
can be cast into the target type T
.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<F, T> TryCastFrom<F> for T where
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for T where
T: CastFrom<F>,
sourcefn can_cast_from(&F) -> bool
fn can_cast_from(&F) -> bool
Test if value
can be cast into Self
.
sourcefn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns Some(Self)
if the source value can be cast into Self
, otherwise None
.
sourcefn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
Returns Ok(Self)
if the source value can be cast into Self
, otherwise calls on_err
.
sourceimpl<F, T> TryCastInto<T> for F where
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for F where
T: TryCastFrom<F>,
sourcefn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if self
can be cast into T
.
sourcefn opt_cast_into(self) -> Option<T>
fn opt_cast_into(self) -> Option<T>
Returns Some(T)
if self
can be cast into T
, otherwise None
.
sourcefn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
Returns Ok(T)
if self
can be cast into T
, otherwise calls on_err
.