pub struct Bundle {
pub contract: Value,
pub schemas: BTreeMap<String, Value>,
pub extras: BTreeMap<String, Value>,
}Expand description
A bundle, in memory.
Fields§
§contract: ValueThe canonical contract.
schemas: BTreeMap<String, Value>Schema artifacts by id: {kind, data}.
extras: BTreeMap<String, Value>Extra artifacts by id (views.v1 documents): {media_type, data}.
Implementations§
Source§impl Bundle
impl Bundle
Sourcepub fn fingerprint(&self) -> Fingerprint
pub fn fingerprint(&self) -> Fingerprint
The fingerprint of the contract inside.
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
The bundle file’s bytes: JCS of Self::to_value.
Sourcepub fn verify(bytes: &[u8]) -> Result<Self, BundleError>
pub fn verify(bytes: &[u8]) -> Result<Self, BundleError>
Parses and verifies a bundle file. On success the bundle is intact: every listed schema is present and hashes to its id, and nothing else is carried.
Sourcepub fn verify_expecting(
bytes: &[u8],
want: &Fingerprint,
) -> Result<Self, BundleError>
pub fn verify_expecting( bytes: &[u8], want: &Fingerprint, ) -> Result<Self, BundleError>
Self::verify, then checks the fingerprint against the one the
caller expected (from a contract key or a descriptor).
Trait Implementations§
impl StructuralPartialEq for Bundle
Auto Trait Implementations§
impl Forget for Bundle
impl Freeze for Bundle
impl RefUnwindSafe for Bundle
impl Send for Bundle
impl Sync for Bundle
impl Unpin for Bundle
impl UnsafeUnpin for Bundle
impl UnwindSafe for Bundle
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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