Skip to main content

TimestampBuilder

Struct TimestampBuilder 

Source
pub struct TimestampBuilder<A: Allocator = Global> { /* private fields */ }

Implementations§

Source§

impl<A: Allocator + Clone> TimestampBuilder<A>

Source

pub fn sha1(&mut self) -> &mut Self

Push the SHA1 opcode.

Source§

impl<A: Allocator + Clone> TimestampBuilder<A>

Source

pub fn ripemd160(&mut self) -> &mut Self

Push the RIPEMD160 opcode.

Source§

impl<A: Allocator + Clone> TimestampBuilder<A>

Source

pub fn sha256(&mut self) -> &mut Self

Push the SHA256 opcode.

Source§

impl<A: Allocator + Clone> TimestampBuilder<A>

Source

pub fn keccak256(&mut self) -> &mut Self

Push the KECCAK256 opcode.

Source§

impl<A: Allocator + Clone> TimestampBuilder<A>

Source

pub fn reverse(&mut self) -> &mut Self

Push the REVERSE opcode.

Source§

impl<A: Allocator + Clone> TimestampBuilder<A>

Source

pub fn hexlify(&mut self) -> &mut Self

Push the HEXLIFY opcode.

Source§

impl<A: Allocator + Clone> TimestampBuilder<A>

Source

pub fn append(&mut self, data: Vec<u8, A>) -> &mut Self

Push the APPEND opcode.

Source§

impl<A: Allocator + Clone> TimestampBuilder<A>

Source

pub fn prepend(&mut self, data: Vec<u8, A>) -> &mut Self

Push the PREPEND opcode.

Source§

impl<A: Allocator + Clone> TimestampBuilder<A>

Source

pub fn new_in(alloc: A) -> TimestampBuilder<A>

Creates a new TimestampBuilder.

Source

pub fn push_step(&mut self, op: OpCode) -> &mut Self

Pushes a new execution step without immediate data to the timestamp.

§Panics

Panics if:

  • the opcode is control opcode
  • the opcode is an opcode with immediate data
Source

pub fn digest<D: DigestOpExt>(&mut self) -> &mut Self

Pushes a new digest step to the timestamp.

Source

pub fn merkle_proof<D: DigestOpExt>( &mut self, proof: SiblingIter<'_, D>, ) -> &mut Self

Pushes the steps corresponding to the given Merkle proof to the timestamp.

Source

pub fn commitment(&self, input: impl AsRef<[u8]>) -> Vec<u8, A>

Computes the commitment of the timestamp for the given input.

In this context, the commitment is the deterministic result of executing the timestamp’s linear chain of operations over the input bytes. It is computed by:

  1. Taking the provided input bytes as the initial value.
  2. Iterating over all steps in the order they were added to the builder.
  3. For each step, applying its opcode to the current value together with the step’s immediate data via OpCode::execute_in, and using the result as the new current value.

The final value after all steps have been applied is returned as the commitment.

Source

pub fn attest<'a, T: Attestation<'a>>( self, attestation: T, ) -> Result<Timestamp<A>, EncodeError>

Finalizes the timestamp with the given attestation.

§Notes

The built timestamp does not include any input data. The input data must be provided later using the finalize method on the Timestamp object.

Source

pub fn concat(self, timestamp: Timestamp<A>) -> Timestamp<A>

Append the given timestamp after the steps in the builder.

Trait Implementations§

Source§

impl<A: Clone + Allocator> Clone for TimestampBuilder<A>

Source§

fn clone(&self) -> TimestampBuilder<A>

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<A: Debug + Allocator> Debug for TimestampBuilder<A>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<A> Freeze for TimestampBuilder<A>
where A: Freeze,

§

impl<A> RefUnwindSafe for TimestampBuilder<A>
where A: RefUnwindSafe,

§

impl<A> Send for TimestampBuilder<A>
where A: Send,

§

impl<A> Sync for TimestampBuilder<A>
where A: Sync,

§

impl<A> Unpin for TimestampBuilder<A>
where A: Unpin,

§

impl<A> UnsafeUnpin for TimestampBuilder<A>
where A: UnsafeUnpin,

§

impl<A> UnwindSafe for TimestampBuilder<A>

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