Struct proof_of_sql::base::commitment::TableCommitment

source ·
pub struct TableCommitment<C>
where C: Commitment,
{ /* private fields */ }
Expand description

Commitment for an entire table, with column and table metadata.

Unlike ColumnCommitments, all columns in this commitment must have the same length.

Implementations§

source§

impl<C: Commitment> TableCommitment<C>

source

pub fn from_accessor_with_max_bounds( table_ref: TableRef, columns: &[ColumnField], accessor: &impl CommitmentAccessor<C>, ) -> Self

Create a new TableCommitment for a table from a commitment accessor.

source

pub fn try_new( column_commitments: ColumnCommitments<C>, range: Range<usize>, ) -> Result<Self, NegativeRange>

Construct a new TableCommitment.

Will error if the range is “negative”, i.e. if its end < start.

source

pub fn column_commitments(&self) -> &ColumnCommitments<C>

Returns a reference to this type’s internal ColumnCommitments.

source

pub fn range(&self) -> &Range<usize>

Returns a reference to the range of rows this type commits to.

source

pub fn num_columns(&self) -> usize

Returns the number of columns in the committed table.

source

pub fn num_rows(&self) -> usize

Returns the number of rows that have been committed to.

source

pub fn try_from_columns_with_offset<'a, COL>( columns: impl IntoIterator<Item = (&'a Identifier, COL)>, offset: usize, setup: &C::PublicSetup<'_>, ) -> Result<TableCommitment<C>, TableCommitmentFromColumnsError>
where COL: Into<CommittableColumn<'a>>,

Returns a TableCommitment to the provided columns with the given row offset.

Provided columns must have the same length and no duplicate identifiers.

source

pub fn from_owned_table_with_offset<S>( owned_table: &OwnedTable<S>, offset: usize, setup: &C::PublicSetup<'_>, ) -> TableCommitment<C>
where S: Scalar,

Returns a TableCommitment to the provided table with the given row offset.

source

pub fn try_append_rows<'a, COL>( &mut self, columns: impl IntoIterator<Item = (&'a Identifier, COL)>, setup: &C::PublicSetup<'_>, ) -> Result<(), AppendTableCommitmentError>
where COL: Into<CommittableColumn<'a>>,

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

The row offset is assumed to be the end of the TableCommitment’s current range.

Will error on a variety of mismatches, or if the provided columns have mixed length.

source

pub fn append_owned_table<S>( &mut self, owned_table: &OwnedTable<S>, setup: &C::PublicSetup<'_>, ) -> Result<(), ColumnCommitmentsMismatch>
where S: Scalar,

Append data of the provided table to the exiting TableCommitment.

Will error on a variety of mismatches. See ColumnCommitmentsMismatch for an enumeration of these errors.

source

pub fn try_extend_columns<'a, COL>( &mut self, columns: impl IntoIterator<Item = (&'a Identifier, COL)>, setup: &C::PublicSetup<'_>, ) -> Result<(), TableCommitmentFromColumnsError>
where COL: Into<CommittableColumn<'a>>,

Add new columns to this TableCommitment.

Columns must have the same length as the current commitment and no duplicate identifiers.

source

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

Add two TableCommitments together.

self must end where other begins, or vice versa. Otherwise, TableCommitmentArithmeticError::NonContiguous is returned.

This will also error on a variety of mismatches. See ColumnCommitmentsMismatch for an enumeration of these errors.

source

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

Subtract two TableCommitments.

self and other must begin at the same row number or end at the same row number. Otherwise, TableCommitmentArithmeticError::NonContiguous is returned.

Furthermore, other’s range must be smaller or equal to self’s. Otherwise, TableCommitmentArithmeticError::NegativeRange is returned.

This will also error on a variety of mismatches. See ColumnCommitmentsMismatch for an enumeration of these errors.

source

pub fn try_append_record_batch( &mut self, batch: &RecordBatch, setup: &C::PublicSetup<'_>, ) -> Result<(), AppendRecordBatchTableCommitmentError>

Append an arrow RecordBatch to the existing TableCommitment.

The row offset is assumed to be the end of the TableCommitment’s current range.

Will error on a variety of mismatches, or if the provided columns have mixed length.

source

pub fn try_from_record_batch( batch: &RecordBatch, setup: &C::PublicSetup<'_>, ) -> Result<TableCommitment<C>, RecordBatchToColumnsError>

Returns a TableCommitment to the provided arrow RecordBatch.

source

pub fn try_from_record_batch_with_offset( batch: &RecordBatch, offset: usize, setup: &C::PublicSetup<'_>, ) -> Result<TableCommitment<C>, RecordBatchToColumnsError>

Returns a TableCommitment to the provided arrow RecordBatch with the given row offset.

Trait Implementations§

source§

impl<C> Clone for TableCommitment<C>
where C: Commitment + Clone,

source§

fn clone(&self) -> TableCommitment<C>

Returns a copy 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<C> Debug for TableCommitment<C>
where C: Commitment + Debug,

source§

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

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

impl<C> Default for TableCommitment<C>
where C: Commitment + Default,

source§

fn default() -> TableCommitment<C>

Returns the “default value” for a type. Read more
source§

impl<'de, C> Deserialize<'de> for TableCommitment<C>
where C: Commitment + Deserialize<'de>,

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<C> PartialEq for TableCommitment<C>
where C: Commitment + PartialEq,

source§

fn eq(&self, other: &TableCommitment<C>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<C> Serialize for TableCommitment<C>
where C: Commitment + Serialize,

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
source§

impl<C> Eq for TableCommitment<C>
where C: Commitment + Eq,

source§

impl<C> StructuralPartialEq for TableCommitment<C>
where C: Commitment,

Auto Trait Implementations§

§

impl<C> Freeze for TableCommitment<C>

§

impl<C> RefUnwindSafe for TableCommitment<C>
where C: RefUnwindSafe,

§

impl<C> Send for TableCommitment<C>

§

impl<C> Sync for TableCommitment<C>

§

impl<C> Unpin for TableCommitment<C>
where C: Unpin,

§

impl<C> UnwindSafe for TableCommitment<C>
where C: UnwindSafe,

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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, 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.
§

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

§

type Output = T

Should always be Self
source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

source§

impl<T> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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> Allocation for T
where T: RefUnwindSafe + Send + Sync,

source§

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