bc_envelope::prelude

Struct CBOR

Source
pub struct CBOR(/* private fields */);
Expand description

A symbolic representation of CBOR data.

Implementations§

Source§

impl CBOR

Source

pub fn as_case(&self) -> &CBORCase

Source

pub fn into_case(self) -> CBORCase

Source§

impl CBOR

Affordances for decoding CBOR from binary representation.

Source

pub fn try_from_data(data: impl AsRef<[u8]>) -> Result<CBOR, Error>

Decodes the given date into CBOR symbolic representation.

Source

pub fn try_from_hex(hex: &str) -> Result<CBOR, Error>

Decodes the given data into CBOR symbolic representation given as a hexadecimal string.

Panics if the string is not well-formed hexadecimal with no spaces or other characters.

Source

pub fn to_cbor_data(&self) -> Vec<u8>

Source§

impl CBOR

Source

pub fn to_byte_string(data: impl AsRef<[u8]>) -> CBOR

Create a new CBOR value representing a byte string.

Source

pub fn to_byte_string_from_hex(hex: impl AsRef<str>) -> CBOR

Create a new CBOR value representing a byte string given as a hexadecimal string.

Panics if the string is not well-formed hexadecimal.

Source

pub fn to_tagged_value(tag: impl Into<Tag>, item: impl Into<CBOR>) -> CBOR

Create a new CBOR value representing a tagged value.

Source§

impl CBOR

Source

pub fn try_into_byte_string(self) -> Result<Vec<u8>, Error>

Extract the CBOR value as a byte string.

Returns Ok if the value is a byte string, Err otherwise.

Source

pub fn into_byte_string(self) -> Option<Vec<u8>>

Source

pub fn try_into_text(self) -> Result<String, Error>

Extract the CBOR value as a text string.

Returns Ok if the value is a text string, Err otherwise.

Source

pub fn try_into_array(self) -> Result<Vec<CBOR>, Error>

Extract the CBOR value as an array.

Returns Ok if the value is an array, Err otherwise.

Source

pub fn try_into_map(self) -> Result<Map, Error>

Extract the CBOR value as a map.

Returns Ok if the value is a map, Err otherwise.

Source

pub fn try_into_tagged_value(self) -> Result<(Tag, CBOR), Error>

Extract the CBOR value as a tagged value.

Returns Ok if the value is a tagged value, Err otherwise.

Source

pub fn try_into_expected_tagged_value( self, expected_tag: impl Into<Tag>, ) -> Result<CBOR, Error>

Extract the CBOR value as an expected tagged value.

Returns Ok if the value is a tagged value with the expected tag, Err otherwise.

Source

pub fn try_into_simple_value(self) -> Result<Simple, Error>

Extract the CBOR value as a simple value.

Returns Ok if the value is a simple value, Err otherwise.

Source§

impl CBOR

Associated constants for common CBOR simple values.

Source

pub fn false() -> CBOR

The CBOR simple value representing false.

Source

pub fn true() -> CBOR

The CBOR simple value representing true.

Source

pub fn null() -> CBOR

The CBOR simple value representing null (None).

Source§

impl CBOR

Affordances for viewing CBOR in diagnostic notation.

Source

pub fn diagnostic_opt( &self, annotate: bool, summarize: bool, flat: bool, tags: Option<&dyn TagsStoreTrait>, ) -> String

Returns a representation of this CBOR in diagnostic notation.

Optionally annotates the output, e.g. formatting dates and adding names of known tags.

Source

pub fn diagnostic(&self) -> String

Returns a representation of this CBOR in diagnostic notation.

Source

pub fn diagnostic_annotated(&self) -> String

Returns a representation of this CBOR in diagnostic notation, with annotations.

Source

pub fn diagnostic_flat(&self) -> String

Source

pub fn summary(&self) -> String

Source

pub fn summary_opt(&self, tags: &dyn TagsStoreTrait) -> String

Source§

impl CBOR

Affordances for viewing the encoded binary representation of CBOR as hexadecimal.

Source

pub fn hex(&self) -> String

Returns the encoded hexadecimal representation of this CBOR.

Source

pub fn hex_opt( &self, annotate: bool, tags: Option<&dyn TagsStoreTrait>, ) -> String

Returns the encoded hexadecimal representation of this CBOR.

Optionally annotates the output, e.g. breaking the output up into semantically meaningful lines, formatting dates, and adding names of known tags.

Source

pub fn hex_annotated(&self) -> String

Returns the encoded hexadecimal representation of this CBOR, with annotations.

Trait Implementations§

Source§

impl Clone for CBOR

Source§

fn clone(&self) -> CBOR

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CBOR

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for CBOR

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl EnvelopeEncodable for CBOR

Source§

impl EnvelopeFormat for CBOR

Source§

impl EnvelopeSummary for CBOR

Source§

fn envelope_summary( &self, max_length: usize, context: &FormatContext, ) -> Result<String>

Source§

impl<T> From<&[T]> for CBOR
where T: Into<CBOR> + Clone,

Source§

fn from(array: &[T]) -> CBOR

Converts to this type from the input type.
Source§

impl From<&str> for CBOR

Source§

fn from(value: &str) -> CBOR

Converts to this type from the input type.
Source§

impl<T, const N: usize> From<[T; N]> for CBOR
where T: Into<CBOR>,

Source§

fn from(array: [T; N]) -> CBOR

Converts to this type from the input type.
Source§

impl From<ARID> for CBOR

Source§

fn from(value: ARID) -> CBOR

Converts to this type from the input type.
Source§

impl From<AgreementPrivateKey> for CBOR

Source§

fn from(value: AgreementPrivateKey) -> CBOR

Converts to this type from the input type.
Source§

impl From<AgreementPublicKey> for CBOR

Source§

fn from(value: AgreementPublicKey) -> CBOR

Converts to this type from the input type.
Source§

impl From<Assertion> for CBOR

Source§

fn from(value: Assertion) -> Self

Converts to this type from the input type.
Source§

impl From<AuthenticationTag> for CBOR

Source§

fn from(value: AuthenticationTag) -> CBOR

Converts to this type from the input type.
Source§

impl<K, V> From<BTreeMap<K, V>> for CBOR
where K: Into<CBOR>, V: Into<CBOR>,

Source§

fn from(container: BTreeMap<K, V>) -> CBOR

Converts to this type from the input type.
Source§

impl From<ByteString> for CBOR

Source§

fn from(value: ByteString) -> CBOR

Converts to this type from the input type.
Source§

impl From<CBORCase> for CBOR

Source§

fn from(case: CBORCase) -> CBOR

Converts to this type from the input type.
Source§

impl From<Compressed> for CBOR

Source§

fn from(value: Compressed) -> CBOR

Converts to this type from the input type.
Source§

impl From<Date> for CBOR

Source§

fn from(value: Date) -> CBOR

Converts to this type from the input type.
Source§

impl From<Digest> for CBOR

Source§

fn from(value: Digest) -> CBOR

Converts to this type from the input type.
Source§

impl From<ECPrivateKey> for CBOR

Source§

fn from(value: ECPrivateKey) -> CBOR

Converts to this type from the input type.
Source§

impl From<ECPublicKey> for CBOR

Source§

fn from(value: ECPublicKey) -> CBOR

Converts to this type from the input type.
Source§

impl From<ECUncompressedPublicKey> for CBOR

Source§

fn from(value: ECUncompressedPublicKey) -> CBOR

Converts to this type from the input type.
Source§

impl From<EncryptedMessage> for CBOR

Source§

fn from(value: EncryptedMessage) -> CBOR

Converts to this type from the input type.
Source§

impl From<Envelope> for CBOR

Source§

fn from(value: Envelope) -> Self

Converts to this type from the input type.
Source§

impl From<Function> for CBOR

Source§

fn from(value: Function) -> Self

Converts to this type from the input type.
Source§

impl<K, V> From<HashMap<K, V>> for CBOR
where K: Into<CBOR>, V: Into<CBOR>,

Source§

fn from(container: HashMap<K, V>) -> CBOR

Converts to this type from the input type.
Source§

impl<T> From<HashSet<T>> for CBOR
where T: Into<CBOR>,

Source§

fn from(set: HashSet<T>) -> CBOR

Converts to this type from the input type.
Source§

impl From<KnownValue> for CBOR

Source§

fn from(value: KnownValue) -> Self

Converts to this type from the input type.
Source§

impl From<Map> for CBOR

Source§

fn from(value: Map) -> CBOR

Converts to this type from the input type.
Source§

impl From<Nonce> for CBOR

Source§

fn from(value: Nonce) -> CBOR

Converts to this type from the input type.
Source§

impl From<Parameter> for CBOR

Source§

fn from(value: Parameter) -> Self

Converts to this type from the input type.
Source§

impl From<PrivateKeyBase> for CBOR

Source§

fn from(value: PrivateKeyBase) -> CBOR

Converts to this type from the input type.
Source§

impl From<PublicKeyBase> for CBOR

Source§

fn from(value: PublicKeyBase) -> CBOR

Converts to this type from the input type.
Source§

impl From<SSKRShare> for CBOR

Source§

fn from(value: SSKRShare) -> CBOR

Converts to this type from the input type.
Source§

impl From<Salt> for CBOR

Source§

fn from(value: Salt) -> CBOR

Converts to this type from the input type.
Source§

impl From<SealedMessage> for CBOR

Source§

fn from(value: SealedMessage) -> CBOR

Converts to this type from the input type.
Source§

impl From<Seed> for CBOR

Source§

fn from(value: Seed) -> CBOR

Converts to this type from the input type.
Source§

impl From<Signature> for CBOR

Source§

fn from(value: Signature) -> CBOR

Converts to this type from the input type.
Source§

impl From<SigningPrivateKey> for CBOR

Source§

fn from(value: SigningPrivateKey) -> CBOR

Converts to this type from the input type.
Source§

impl From<SigningPublicKey> for CBOR

Source§

fn from(value: SigningPublicKey) -> CBOR

Converts to this type from the input type.
Source§

impl From<Simple> for CBOR

Source§

fn from(value: Simple) -> CBOR

Converts to this type from the input type.
Source§

impl From<String> for CBOR

Source§

fn from(value: String) -> CBOR

Converts to this type from the input type.
Source§

impl From<SymmetricKey> for CBOR

Source§

fn from(value: SymmetricKey) -> CBOR

Converts to this type from the input type.
Source§

impl From<UR> for CBOR

Source§

fn from(ur: UR) -> CBOR

Converts to this type from the input type.
Source§

impl From<URI> for CBOR

Source§

fn from(value: URI) -> CBOR

Converts to this type from the input type.
Source§

impl From<UUID> for CBOR

Source§

fn from(value: UUID) -> CBOR

Converts to this type from the input type.
Source§

impl<T> From<Vec<T>> for CBOR
where T: Into<CBOR>,

Source§

fn from(vec: Vec<T>) -> CBOR

Converts to this type from the input type.
Source§

impl<T> From<VecDeque<T>> for CBOR
where T: Into<CBOR>,

Source§

fn from(deque: VecDeque<T>) -> CBOR

Converts to this type from the input type.
Source§

impl From<XID> for CBOR

Source§

fn from(value: XID) -> CBOR

Converts to this type from the input type.
Source§

impl From<bool> for CBOR

Source§

fn from(value: bool) -> CBOR

Converts to this type from the input type.
Source§

impl From<f16> for CBOR

Source§

fn from(value: f16) -> CBOR

Converts to this type from the input type.
Source§

impl From<f32> for CBOR

Source§

fn from(value: f32) -> CBOR

Converts to this type from the input type.
Source§

impl From<f64> for CBOR

Source§

fn from(value: f64) -> CBOR

Converts to this type from the input type.
Source§

impl From<i16> for CBOR

Source§

fn from(value: i16) -> CBOR

Converts to this type from the input type.
Source§

impl From<i32> for CBOR

Source§

fn from(value: i32) -> CBOR

Converts to this type from the input type.
Source§

impl From<i64> for CBOR

Source§

fn from(value: i64) -> CBOR

Converts to this type from the input type.
Source§

impl From<i8> for CBOR

Source§

fn from(value: i8) -> CBOR

Converts to this type from the input type.
Source§

impl From<u16> for CBOR

Source§

fn from(value: u16) -> CBOR

Converts to this type from the input type.
Source§

impl From<u32> for CBOR

Source§

fn from(value: u32) -> CBOR

Converts to this type from the input type.
Source§

impl From<u64> for CBOR

Source§

fn from(value: u64) -> CBOR

Converts to this type from the input type.
Source§

impl From<u8> for CBOR

Source§

fn from(value: u8) -> CBOR

Converts to this type from the input type.
Source§

impl From<usize> for CBOR

Source§

fn from(value: usize) -> CBOR

Converts to this type from the input type.
Source§

impl PartialEq for CBOR

Source§

fn eq(&self, other: &CBOR) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<CBOR> for Assertion

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: CBOR) -> Result<Self>

Performs the conversion.
Source§

impl<K, V> TryFrom<CBOR> for BTreeMap<K, V>
where K: TryFrom<CBOR, Error = Error> + Eq + Ord + Clone, V: TryFrom<CBOR, Error = Error> + Clone,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(cbor: CBOR) -> Result<BTreeMap<K, V>, Error>

Performs the conversion.
Source§

impl TryFrom<CBOR> for ByteString

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from( cbor: CBOR, ) -> Result<ByteString, <ByteString as TryFrom<CBOR>>::Error>

Performs the conversion.
Source§

impl TryFrom<CBOR> for Digest

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(cbor: CBOR) -> Result<Digest, <Digest as TryFrom<CBOR>>::Error>

Performs the conversion.
Source§

impl TryFrom<CBOR> for Envelope

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: CBOR) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<CBOR> for Function

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(cbor: CBOR) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<CBOR> for KnownValue

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(cbor: CBOR) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<CBOR> for Parameter

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(cbor: CBOR) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<CBOR> for PrivateKeyBase

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from( cbor: CBOR, ) -> Result<PrivateKeyBase, <PrivateKeyBase as TryFrom<CBOR>>::Error>

Performs the conversion.
Source§

impl TryFrom<CBOR> for PublicKeyBase

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from( cbor: CBOR, ) -> Result<PublicKeyBase, <PublicKeyBase as TryFrom<CBOR>>::Error>

Performs the conversion.
Source§

impl TryFrom<CBOR> for SSKRShare

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from( cbor: CBOR, ) -> Result<SSKRShare, <SSKRShare as TryFrom<CBOR>>::Error>

Performs the conversion.
Source§

impl<T> TryFrom<CBOR> for Vec<T>
where T: TryFrom<CBOR, Error = Error> + Clone,

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(cbor: CBOR) -> Result<Vec<T>, Error>

Performs the conversion.

Auto Trait Implementations§

§

impl Freeze for CBOR

§

impl RefUnwindSafe for CBOR

§

impl Send for CBOR

§

impl Sync for CBOR

§

impl Unpin for CBOR

§

impl UnwindSafe for CBOR

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CBOREncodable for T
where T: Into<CBOR> + Clone,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> CBORCodable for T

Source§

impl<T> CBORDecodable for T
where T: TryFrom<CBOR>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T