Invoice

Struct Invoice 

Source
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

Source

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.

Source

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”

Source

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].

Source

pub fn has_group(&self, name: &str) -> bool

Check whether a group by this name is present.

Source

pub fn group_members(&self, name: &str) -> Vec<Parcel>

Get all of the parcels on the given group.

Source

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>
where T: Into<Invoice> + Borrow<Invoice>,

Source§

fn borrow(&self) -> &Invoice

Immutably borrows from an owned value. Read more
Source§

impl<T> Borrow<Invoice> for VerifiedInvoice<T>
where T: Into<Invoice> + Borrow<Invoice>,

Source§

fn borrow(&self) -> &Invoice

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<Invoice> for VerifiedInvoice<T>

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl Clone for Invoice

Source§

fn clone(&self) -> Invoice

Returns a duplicate 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 Invoice

Source§

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

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

impl<'de> Deserialize<'de> for Invoice

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T: Into<Invoice>> Into<Invoice> for VerifiedInvoice<T>

Source§

fn into(self) -> Invoice

Converts this type into the (usually inferred) input type.
Source§

impl Serialize for Invoice

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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, 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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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