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.orgVariants§
Step(Step<A>)
Attestation(RawAttestation<A>)
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn builder() -> TimestampBuilder<Global>
pub fn builder() -> TimestampBuilder<Global>
Creates a new timestamp builder.
Source§impl<A: Allocator> Timestamp<A>
impl<A: Allocator> Timestamp<A>
Sourcepub fn as_attestation(&self) -> Option<&RawAttestation<A>>
pub fn as_attestation(&self) -> Option<&RawAttestation<A>>
Returns this timestamp as an attestation, if it is one.
Sourcepub fn is_finalized(&self) -> bool
pub fn is_finalized(&self) -> bool
Returns true if this timestamp is finalized.
Sourcepub fn attestations(&self) -> AttestationIter<'_, A>
pub fn attestations(&self) -> AttestationIter<'_, A>
Iterates over all attestations in this timestamp.
Sourcepub fn pending_attestations_mut(&mut self) -> PendingAttestationIterMut<'_, A>
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>
impl<A: Allocator + Clone> Timestamp<A>
Sourcepub fn builder_in(alloc: A) -> TimestampBuilder<A>
pub fn builder_in(alloc: A) -> TimestampBuilder<A>
Creates a new timestamp builder with the given allocator.
Sourcepub fn finalize(&self, input: &[u8])
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.
Sourcepub fn try_finalize(&self, input: &[u8]) -> Result<(), FinalizationError>
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.
Sourcepub fn merge_in(timestamps: Vec<Timestamp<A>, A>, alloc: A) -> Timestamp<A>
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.
Sourcepub fn try_merge_in(
timestamps: Vec<Timestamp<A>, A>,
alloc: A,
) -> Result<Timestamp<A>, FinalizationError>
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: Allocator + Clone> DecodeIn<A> for Timestamp<A>
impl<A: Allocator + Clone> DecodeIn<A> for Timestamp<A>
Source§fn decode_in(decoder: &mut impl Decoder, alloc: A) -> Result<Self, DecodeError>
fn decode_in(decoder: &mut impl Decoder, alloc: A) -> Result<Self, DecodeError>
Decode::decode for details.Source§fn decode_trailing(
decoder: &mut impl Decoder,
alloc: A,
) -> Result<Option<Self>, DecodeError>
fn decode_trailing( decoder: &mut impl Decoder, alloc: A, ) -> Result<Option<Self>, DecodeError>
Decode::decode_trailing for details and caveats.