pub struct Assertion { /* private fields */ }
Expand description

Represents an assertion.

Generally you do not create an instance of this type directly, but instead use Envelope::new_assertion, or the various functions on Envelope that create assertions.

Implementations§

source§

impl Assertion

source

pub fn new( predicate: impl EnvelopeEncodable, object: impl EnvelopeEncodable ) -> Self

Creates an assertion and calculates its digest.

source

pub fn predicate(&self) -> Envelope

Returns the predicate of the assertion.

source

pub fn object(&self) -> Envelope

Returns the object of the assertion.

source

pub fn digest_ref(&self) -> &Digest

Returns the digest of the assertion.

source§

impl Assertion

source

pub fn new_attachment<A>( payload: A, vendor: &str, conforms_to: Option<&str> ) -> Self

Creates an attachment assertion. See: BCR-2023-006

source

pub fn attachment_payload(&self) -> Result<Envelope, EnvelopeError>

Returns the payload of the given attachment assertion.

source

pub fn attachment_vendor(&self) -> Result<String>

Returns the vendor of the given attachment assertion.

source

pub fn attachment_conforms_to(&self) -> Result<Option<String>>

Returns the conformsTo of the given attachment assertion.

source

pub fn validate_attachment(&self) -> Result<()>

Validates the given attachment assertion.

Ensures:

  • The attachment assertion’s predicate is known_values::ATTACHMENT.
  • The attachment assertion’s object is an envelope.
  • The attachment assertion’s object has a 'vendor': String assertion.
  • The attachment assertion’s object has an optional 'conformsTo': String assertion.

Trait Implementations§

source§

impl CBORDecodable for Assertion

source§

fn from_cbor(cbor: &CBOR) -> Result<Self>

Creates an instance of this type from CBOR symbolic representation.
source§

fn from_cbor_data(cbor_data: &[u8]) -> Result<Self, Error>
where Self: Sized,

Creates an instance of this type from encoded CBOR binary data.
source§

impl CBOREncodable for Assertion

source§

fn cbor(&self) -> CBOR

Returns the value in CBOR symbolic representation.
source§

fn cbor_data(&self) -> Vec<u8>

Returns the value in CBOR binary representation.
source§

impl Clone for Assertion

source§

fn clone(&self) -> Assertion

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 Assertion

source§

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

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

impl DigestProvider for Assertion

source§

fn digest(&self) -> Cow<'_, Digest>

source§

impl EnvelopeEncodable for Assertion

source§

impl EnvelopeFormat for Assertion

source§

impl From<Assertion> for CBOR

source§

fn from(value: Assertion) -> Self

Converts to this type from the input type.
source§

impl From<Assertion> for Envelope

source§

fn from(assertion: Assertion) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Assertion

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<CBOR> for Assertion

§

type Error = Error

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

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

Performs the conversion.
source§

impl CBORCodable for Assertion

source§

impl Eq for Assertion

Auto Trait Implementations§

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> 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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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