Struct bc_components::CID
source · pub struct CID(_);
Expand description
A “Common Identifier” (CID)
As defined in BCR-2022-002.
Implementations§
source§impl CID
impl CID
pub const CID_SIZE: usize = 32usize
sourcepub fn from_data_ref<T>(data: &T) -> Option<Self>where
T: AsRef<[u8]>,
pub fn from_data_ref<T>(data: &T) -> Option<Self>where T: AsRef<[u8]>,
Create a new CID from a reference to an array of bytes.
sourcepub fn from_hex<T>(hex: T) -> Selfwhere
T: AsRef<str>,
pub fn from_hex<T>(hex: T) -> Selfwhere T: AsRef<str>,
Create a new CID from the given hexadecimal string.
Panics
Panics if the string is not exactly 64 hexadecimal digits.
sourcepub fn short_description(&self) -> String
pub fn short_description(&self) -> String
The first four bytes of the CID as a hexadecimal string.
Trait Implementations§
source§impl CBORDecodable for CID
impl CBORDecodable for CID
source§impl CBOREncodable for CID
impl CBOREncodable for CID
source§impl CBORTagged for CID
impl CBORTagged for CID
source§impl CBORTaggedDecodable for CID
impl CBORTaggedDecodable for CID
source§fn from_untagged_cbor(untagged_cbor: &CBOR) -> Result<Self, Error>
fn from_untagged_cbor(untagged_cbor: &CBOR) -> Result<Self, Error>
Creates an instance of this type by decoding it from untagged CBOR.
source§fn from_tagged_cbor(cbor: &CBOR) -> Result<Self, Error>where
Self: Sized,
fn from_tagged_cbor(cbor: &CBOR) -> Result<Self, Error>where Self: Sized,
Creates an instance of this type by decoding it from tagged CBOR.
source§impl CBORTaggedEncodable for CID
impl CBORTaggedEncodable for CID
source§fn untagged_cbor(&self) -> CBOR
fn untagged_cbor(&self) -> CBOR
Returns the untagged CBOR encoding of this instance.
source§fn tagged_cbor(&self) -> CBOR
fn tagged_cbor(&self) -> CBOR
Returns the tagged CBOR encoding of this instance.
source§impl PartialOrd<CID> for CID
impl PartialOrd<CID> for CID
1.0.0 · source§fn 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 moreimpl Eq for CID
impl StructuralEq for CID
impl StructuralPartialEq for CID
Auto Trait Implementations§
impl RefUnwindSafe for CID
impl Send for CID
impl Sync for CID
impl Unpin for CID
impl UnwindSafe for CID
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