Trait VecCommitmentExt

Source
pub trait VecCommitmentExt {
    type CommitmentPublicSetup<'a>;

    // Required methods
    fn from_columns_with_offset<'a, C>(
        columns: impl IntoIterator<Item = C>,
        offset: usize,
        setup: &Self::CommitmentPublicSetup<'_>,
    ) -> Self
       where C: Into<CommittableColumn<'a>>;
    fn from_committable_columns_with_offset(
        committable_columns: &[CommittableColumn<'_>],
        offset: usize,
        setup: &Self::CommitmentPublicSetup<'_>,
    ) -> Self;
    fn try_append_rows_with_offset<'a, C>(
        &mut self,
        columns: impl IntoIterator<Item = C>,
        offset: usize,
        setup: &Self::CommitmentPublicSetup<'_>,
    ) -> Result<(), NumColumnsMismatch>
       where C: Into<CommittableColumn<'a>>;
    fn extend_columns_with_offset<'a, C>(
        &mut self,
        columns: impl IntoIterator<Item = C>,
        offset: usize,
        setup: &Self::CommitmentPublicSetup<'_>,
    )
       where C: Into<CommittableColumn<'a>>;
    fn try_add(self, other: Self) -> Result<Self, NumColumnsMismatch>
       where Self: Sized;
    fn try_sub(self, other: Self) -> Result<Self, NumColumnsMismatch>
       where Self: Sized;
    fn num_commitments(&self) -> usize;
}
Expand description

Extension trait intended for collections of commitments.

Implemented for Vec<CompressedRistretto>.

Required Associated Types§

Source

type CommitmentPublicSetup<'a>

The public setup parameters required to compute the commitments. This is simply precomputed data that is required to compute the commitments.

Required Methods§

Source

fn from_columns_with_offset<'a, C>( columns: impl IntoIterator<Item = C>, offset: usize, setup: &Self::CommitmentPublicSetup<'_>, ) -> Self
where C: Into<CommittableColumn<'a>>,

Returns a collection of commitments to the provided columns using the given generator offset.

Source

fn from_committable_columns_with_offset( committable_columns: &[CommittableColumn<'_>], offset: usize, setup: &Self::CommitmentPublicSetup<'_>, ) -> Self

Returns a collection of commitments to the provided slice of CommittableColumns using the given generator offset.

Source

fn try_append_rows_with_offset<'a, C>( &mut self, columns: impl IntoIterator<Item = C>, offset: usize, setup: &Self::CommitmentPublicSetup<'_>, ) -> Result<(), NumColumnsMismatch>
where C: Into<CommittableColumn<'a>>,

Append rows of data from the provided columns to the existing commitments.

The given generator offset will be used for committing to the new rows. You most likely want this to be equal to the 0-indexed row number of the first new row.

The number of columns provided must match the number of columns already committed to.

Source

fn extend_columns_with_offset<'a, C>( &mut self, columns: impl IntoIterator<Item = C>, offset: usize, setup: &Self::CommitmentPublicSetup<'_>, )
where C: Into<CommittableColumn<'a>>,

Add commitments to new columns to this collection using the given generator offset.

Source

fn try_add(self, other: Self) -> Result<Self, NumColumnsMismatch>
where Self: Sized,

Add two collections of commitments if they have equal column counts.

Source

fn try_sub(self, other: Self) -> Result<Self, NumColumnsMismatch>
where Self: Sized,

Subtract two collections of commitments if they have equal column counts.

Source

fn num_commitments(&self) -> usize

Returns the number of commitments in the collection.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<C: Commitment> VecCommitmentExt for Vec<C>

Source§

type CommitmentPublicSetup<'a> = <C as Commitment>::PublicSetup<'a>

Source§

fn from_columns_with_offset<'a, COL>( columns: impl IntoIterator<Item = COL>, offset: usize, setup: &Self::CommitmentPublicSetup<'_>, ) -> Self
where COL: Into<CommittableColumn<'a>>,

Source§

fn from_committable_columns_with_offset( committable_columns: &[CommittableColumn<'_>], offset: usize, setup: &Self::CommitmentPublicSetup<'_>, ) -> Self

Source§

fn try_append_rows_with_offset<'a, COL>( &mut self, columns: impl IntoIterator<Item = COL>, offset: usize, setup: &Self::CommitmentPublicSetup<'_>, ) -> Result<(), NumColumnsMismatch>
where COL: Into<CommittableColumn<'a>>,

Source§

fn extend_columns_with_offset<'a, COL>( &mut self, columns: impl IntoIterator<Item = COL>, offset: usize, setup: &Self::CommitmentPublicSetup<'_>, )
where COL: Into<CommittableColumn<'a>>,

Source§

fn try_add(self, other: Self) -> Result<Self, NumColumnsMismatch>
where Self: Sized,

Source§

fn try_sub(self, other: Self) -> Result<Self, NumColumnsMismatch>
where Self: Sized,

Source§

fn num_commitments(&self) -> usize

Implementors§