Skip to main content

Timestamp

Enum Timestamp 

Source
pub enum Timestamp<A: Allocator = Global> {
    Step(Step<A>),
    Attestation(RawAttestation<A>),
}
Expand description

Proof that that one or more attestations commit to a message.

This should not be confused with DetachedTimestamp, single Timestamps DO NOT include the digest of the message they commit to.

Sample Timestamp:

execute APPEND 7d9472db4ae254e8
execute SHA256
execute APPEND 65191d41c625e4505a442928ec4211b3
execute SHA256
execute APPEND 000639ee5837a935dce596c85f1ce323d5219afe84ee0832ee6614924f4c6598
execute SHA256
execute PREPEND 6944db61
execute APPEND 0ef41e45bb5534b3
result attested by Pending: update URI https://alice.btc.calendar.opentimestamps.org

Variants§

§

Step(Step<A>)

§

Attestation(RawAttestation<A>)

Implementations§

Source§

impl Timestamp

Source

pub fn builder() -> TimestampBuilder<Global>

Creates a new timestamp builder.

Source

pub fn merge(timestamps: Vec<Timestamp, Global>) -> Timestamp

Merges multiple timestamps into a single FORK timestamp.

§Panics

This will panic if there are conflicting inputs when finalizing unfinalized timestamps.

Source

pub fn try_merge( timestamps: Vec<Timestamp, Global>, ) -> Result<Timestamp, FinalizationError>

Try to merge multiple timestamps into a single FORK timestamp.

Returns an error if there are conflicting inputs when finalizing unfinalized timestamps.

Source§

impl<A: Allocator> Timestamp<A>

Source

pub fn op(&self) -> OpCode

Returns the opcode of this timestamp node.

Source

pub fn as_step(&self) -> Option<&Step<A>>

Returns this timestamp as a step, if it is one.

Source

pub fn as_attestation(&self) -> Option<&RawAttestation<A>>

Returns this timestamp as an attestation, if it is one.

Source

pub fn allocator(&self) -> &A

Returns the allocator used by this timestamp node.

Source

pub fn is_finalized(&self) -> bool

Returns true if this timestamp is finalized.

Source

pub fn attestations(&self) -> AttestationIter<'_, A>

Iterates over all attestations in this timestamp.

Source

pub fn pending_attestations_mut(&mut self) -> PendingAttestationIterMut<'_, A>

Iterates over all pending attestation steps in this timestamp.

§Note

This iterator will yield Timestamp instead of RawAttestation.

Source§

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

Source

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

Creates a new timestamp builder with the given allocator.

Source

pub fn finalize(&self, input: &[u8])

Finalizes the timestamp with the given input data.

§Panics

Panics if the timestamp is already finalized with different input data.

Source

pub fn try_finalize(&self, input: &[u8]) -> Result<(), FinalizationError>

Try finalizes the timestamp with the given input data.

Returns an error if the timestamp is already finalized with different input data.

Source

pub fn merge_in(timestamps: Vec<Timestamp<A>, A>, alloc: A) -> Timestamp<A>

Merges multiple timestamps into a single FORK timestamp.

§Panics

This will panic if there are conflicting inputs when finalizing unfinalized timestamps.

Source

pub fn try_merge_in( timestamps: Vec<Timestamp<A>, A>, alloc: A, ) -> Result<Timestamp<A>, FinalizationError>

Merges multiple timestamps into a single FORK timestamp.

This will attempt to finalize unfinalized timestamps if any of the input timestamps are finalized.

Returns an error if there are conflicting inputs when finalizing unfinalized timestamps.

Trait Implementations§

Source§

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

Source§

fn clone(&self) -> Timestamp<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 Timestamp<A>

Source§

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

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

impl<A: Allocator + Clone> DecodeIn<A> for Timestamp<A>

Source§

fn decode_in(decoder: &mut impl Decoder, alloc: A) -> Result<Self, DecodeError>

See Decode::decode for details.
Source§

fn decode_trailing( decoder: &mut impl Decoder, alloc: A, ) -> Result<Option<Self>, DecodeError>

See Decode::decode_trailing for details and caveats.
Source§

impl<A: Allocator + Clone> Display for Timestamp<A>

Source§

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

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

impl<A: Allocator> Encode for Timestamp<A>

Source§

fn encode(&self, encoder: &mut impl Encoder) -> Result<(), EncodeError>

Source§

impl<A: Allocator> MayHaveInput for Timestamp<A>

Source§

fn input(&self) -> Option<&[u8]>

Returns the input data for this object, if finalized.
Source§

impl<A: Allocator> PartialEq for Timestamp<A>

Source§

fn eq(&self, other: &Self) -> 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<A: Allocator> Eq for Timestamp<A>

Auto Trait Implementations§

§

impl<A = Global> !Freeze for Timestamp<A>

§

impl<A> RefUnwindSafe for Timestamp<A>

§

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

§

impl<A> Sync for Timestamp<A>
where A: Sync + Send,

§

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

§

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

§

impl<A> UnwindSafe for Timestamp<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, U> ConsistentWith<U> for T
where T: MayHaveInput, U: ToInput + ?Sized,

Source§

fn is_consistent_with(&self, other: &T) -> bool

Checks if self is consistent with the given input. Read more
Source§

fn is_consistent_with_strict(&self, other: &T) -> bool

Checks if self is consistent with the given input. Read more
Source§

impl<T> Decode for T
where T: DecodeIn<Global>,

Source§

fn decode(decoder: &mut impl Decoder) -> Result<T, DecodeError>

Source§

fn decode_trailing(decoder: &mut impl Decoder) -> Result<Option<T>, DecodeError>

Decodes a trailing optional value implementing the Decode trait. 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<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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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