pub struct Invoice {
pub bindle_version: String,
pub yanked: Option<bool>,
pub yanked_signature: Option<Vec<Signature>>,
pub bindle: BindleSpec,
pub annotations: Option<AnnotationMap>,
pub parcel: Option<Vec<Parcel>>,
pub group: Option<Vec<Group>>,
pub signature: Option<Vec<Signature>>,
}Expand description
The main structure for a Bindle invoice.
The invoice describes a specific version of a bindle. For example, the bindle
foo/bar/1.0.0 would be represented as an Invoice with the BindleSpec name
set to foo/bar and version set to 1.0.0.
Most fields on this struct are singular to best represent the specification. There,
fields like group and parcel are singular due to the conventions of TOML.
Fields§
§bindle_version: String§yanked: Option<bool>§yanked_signature: Option<Vec<Signature>>§bindle: BindleSpec§annotations: Option<AnnotationMap>§parcel: Option<Vec<Parcel>>§group: Option<Vec<Group>>§signature: Option<Vec<Signature>>Implementations§
Source§impl Invoice
impl Invoice
Sourcepub fn new(spec: BindleSpec) -> Self
pub fn new(spec: BindleSpec) -> Self
Create a new Invoice with a bindle specification.
The returned bindle will have no parcels, annotations, signatures, or groups.
Sourcepub fn name(&self) -> String
pub fn name(&self) -> String
produce a slash-delimited “invoice name”
For example, an invoice with the bindle name “hello” and the bindle version “1.2.3” will produce “hello/1.2.3”
Sourcepub fn canonical_name(&self) -> String
pub fn canonical_name(&self) -> String
Creates a standard name for an invoice
This is designed to create a repeatable opaque name for the invoice We don’t typically want to have a bindle ID using its name and version number. This would impose both naming constraints on the bindle and security issues on the storage layout. So this function hashes the name/version data (which together MUST be unique in the system) and uses the resulting hash as the canonical name. The hash is guaranteed to be in the character set [a-zA-Z0-9].
Sourcepub fn group_members(&self, name: &str) -> Vec<Parcel>
pub fn group_members(&self, name: &str) -> Vec<Parcel>
Get all of the parcels on the given group.
Sourcepub fn sign(
&mut self,
signer_role: SignatureRole,
keyfile: &SecretKeyEntry,
) -> Result<(), SignatureError>
pub fn sign( &mut self, signer_role: SignatureRole, keyfile: &SecretKeyEntry, ) -> Result<(), SignatureError>
Sign the parcels on the current package.
Note that this signature will be invalidated if any parcels are added after this signature.
In the current version of the spec, a signature is generated by combining the
signer’s ID, the invoice version, and a list of parcels, and then performing
a cryptographic signature on those fields. The result is then stored in
a [[signature]] block on the invoice. Multiple signatures can be attached
to any invoice.
Trait Implementations§
Source§impl<T> Borrow<Invoice> for SignedInvoice<T>
impl<T> Borrow<Invoice> for SignedInvoice<T>
Source§impl<T> Borrow<Invoice> for VerifiedInvoice<T>
impl<T> Borrow<Invoice> for VerifiedInvoice<T>
Source§impl<T> BorrowMut<Invoice> for VerifiedInvoice<T>
impl<T> BorrowMut<Invoice> for VerifiedInvoice<T>
Source§fn borrow_mut(&mut self) -> &mut Invoice
fn borrow_mut(&mut self) -> &mut Invoice
Source§impl<'de> Deserialize<'de> for Invoice
impl<'de> Deserialize<'de> for Invoice
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Invoice
impl RefUnwindSafe for Invoice
impl Send for Invoice
impl Sync for Invoice
impl Unpin for Invoice
impl UnwindSafe for Invoice
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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