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>
impl<C: Commitment> TableCommitment<C>
Sourcepub fn try_append_record_batch(
&mut self,
batch: &RecordBatch,
setup: &C::PublicSetup<'_>,
) -> Result<(), AppendRecordBatchTableCommitmentError>
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.
Sourcepub fn try_from_record_batch(
batch: &RecordBatch,
setup: &C::PublicSetup<'_>,
) -> Result<TableCommitment<C>, RecordBatchToColumnsError>
pub fn try_from_record_batch( batch: &RecordBatch, setup: &C::PublicSetup<'_>, ) -> Result<TableCommitment<C>, RecordBatchToColumnsError>
Returns a TableCommitment
to the provided arrow RecordBatch
.
Sourcepub fn try_from_record_batch_with_offset(
batch: &RecordBatch,
offset: usize,
setup: &C::PublicSetup<'_>,
) -> Result<TableCommitment<C>, RecordBatchToColumnsError>
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.
Source§impl<C: Commitment> TableCommitment<C>
impl<C: Commitment> TableCommitment<C>
Sourcepub fn from_accessor_with_max_bounds(
table_ref: TableRef,
columns: &[ColumnField],
accessor: &impl CommitmentAccessor<C>,
) -> Self
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.
Sourcepub fn try_new(
column_commitments: ColumnCommitments<C>,
range: Range<usize>,
) -> Result<Self, NegativeRange>
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.
Sourcepub fn column_commitments(&self) -> &ColumnCommitments<C>
pub fn column_commitments(&self) -> &ColumnCommitments<C>
Returns a reference to this type’s internal ColumnCommitments
.
Sourcepub fn range(&self) -> &Range<usize>
pub fn range(&self) -> &Range<usize>
Returns a reference to the range of rows this type commits to.
Sourcepub fn num_columns(&self) -> usize
pub fn num_columns(&self) -> usize
Returns the number of columns in the committed table.
Sourcepub fn try_from_columns_with_offset<'a, COL>(
columns: impl IntoIterator<Item = (&'a Ident, COL)>,
offset: usize,
setup: &C::PublicSetup<'_>,
) -> Result<TableCommitment<C>, TableCommitmentFromColumnsError>where
COL: Into<CommittableColumn<'a>>,
pub fn try_from_columns_with_offset<'a, COL>(
columns: impl IntoIterator<Item = (&'a Ident, 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 idents.
Sourcepub fn from_owned_table_with_offset<S>(
owned_table: &OwnedTable<S>,
offset: usize,
setup: &C::PublicSetup<'_>,
) -> TableCommitment<C>where
S: Scalar,
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.
Sourcepub fn try_append_rows<'a, COL>(
&mut self,
columns: impl IntoIterator<Item = (&'a Ident, COL)>,
setup: &C::PublicSetup<'_>,
) -> Result<(), AppendTableCommitmentError>where
COL: Into<CommittableColumn<'a>>,
pub fn try_append_rows<'a, COL>(
&mut self,
columns: impl IntoIterator<Item = (&'a Ident, 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.
Sourcepub fn append_owned_table<S>(
&mut self,
owned_table: &OwnedTable<S>,
setup: &C::PublicSetup<'_>,
) -> Result<(), ColumnCommitmentsMismatch>where
S: Scalar,
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.
§Panics
Panics if owned_table
has duplicate idents.
Panics if owned_table
contains columns of mixed length.
Sourcepub fn try_extend_columns<'a, COL>(
&mut self,
columns: impl IntoIterator<Item = (&'a Ident, COL)>,
setup: &C::PublicSetup<'_>,
) -> Result<(), TableCommitmentFromColumnsError>where
COL: Into<CommittableColumn<'a>>,
pub fn try_extend_columns<'a, COL>(
&mut self,
columns: impl IntoIterator<Item = (&'a Ident, 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 idents.
Sourcepub fn try_add(
self,
other: Self,
) -> Result<Self, TableCommitmentArithmeticError>where
Self: Sized,
pub fn try_add(
self,
other: Self,
) -> Result<Self, TableCommitmentArithmeticError>where
Self: Sized,
Add two TableCommitment
s 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.
Sourcepub fn try_sub(
self,
other: Self,
) -> Result<Self, TableCommitmentArithmeticError>where
Self: Sized,
pub fn try_sub(
self,
other: Self,
) -> Result<Self, TableCommitmentArithmeticError>where
Self: Sized,
Subtract two TableCommitment
s.
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.
Trait Implementations§
Source§impl<C> Clone for TableCommitment<C>where
C: Commitment + Clone,
impl<C> Clone for TableCommitment<C>where
C: Commitment + Clone,
Source§fn clone(&self) -> TableCommitment<C>
fn clone(&self) -> TableCommitment<C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<C> Debug for TableCommitment<C>where
C: Commitment + Debug,
impl<C> Debug for TableCommitment<C>where
C: Commitment + Debug,
Source§impl<C> Default for TableCommitment<C>where
C: Commitment + Default,
impl<C> Default for TableCommitment<C>where
C: Commitment + Default,
Source§fn default() -> TableCommitment<C>
fn default() -> TableCommitment<C>
Source§impl<'de, C> Deserialize<'de> for TableCommitment<C>where
C: Commitment + Deserialize<'de>,
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>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<C> PartialEq for TableCommitment<C>where
C: Commitment + PartialEq,
impl<C> PartialEq for TableCommitment<C>where
C: Commitment + PartialEq,
Source§impl<C> Serialize for TableCommitment<C>where
C: Commitment + Serialize,
impl<C> Serialize for TableCommitment<C>where
C: Commitment + Serialize,
impl<C> Eq for TableCommitment<C>where
C: Commitment + Eq,
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> 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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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