Struct bc_envelope::base::assertion::Assertion
source · 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
impl Assertion
sourcepub fn new(
predicate: impl EnvelopeEncodable,
object: impl EnvelopeEncodable
) -> Self
pub fn new( predicate: impl EnvelopeEncodable, object: impl EnvelopeEncodable ) -> Self
Creates an assertion and calculates its digest.
sourcepub fn digest_ref(&self) -> &Digest
pub fn digest_ref(&self) -> &Digest
Returns the digest of the assertion.
source§impl Assertion
impl Assertion
sourcepub fn new_attachment<A>(
payload: A,
vendor: &str,
conforms_to: Option<&str>
) -> Selfwhere
A: EnvelopeEncodable,
pub fn new_attachment<A>( payload: A, vendor: &str, conforms_to: Option<&str> ) -> Selfwhere A: EnvelopeEncodable,
Creates an attachment assertion. See: BCR-2023-006
sourcepub fn attachment_payload(&self) -> Result<Envelope, EnvelopeError>
pub fn attachment_payload(&self) -> Result<Envelope, EnvelopeError>
Returns the payload of the given attachment assertion.
sourcepub fn attachment_vendor(&self) -> Result<String>
pub fn attachment_vendor(&self) -> Result<String>
Returns the vendor of the given attachment assertion.
sourcepub fn attachment_conforms_to(&self) -> Result<Option<String>>
pub fn attachment_conforms_to(&self) -> Result<Option<String>>
Returns the conformsTo of the given attachment assertion.
sourcepub fn validate_attachment(&self) -> Result<()>
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': Stringassertion. - The attachment assertion’s object has an optional
'conformsTo': Stringassertion.
Trait Implementations§
source§impl CBORDecodable for Assertion
impl CBORDecodable for Assertion
source§impl CBOREncodable for Assertion
impl CBOREncodable for Assertion
source§impl EnvelopeFormat for Assertion
impl EnvelopeFormat for Assertion
fn format_item(&self, context: &FormatContext) -> EnvelopeFormatItem
source§impl PartialEq for Assertion
impl PartialEq for Assertion
impl CBORCodable for Assertion
impl Eq for Assertion
Auto Trait Implementations§
impl RefUnwindSafe for Assertion
impl !Send for Assertion
impl !Sync for Assertion
impl Unpin for Assertion
impl UnwindSafe for Assertion
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