pub struct DetachedTimestamp<A: Allocator = Global> { /* private fields */ }Expand description
A file containing a timestamp for another file Contains a timestamp, along with a header and the digest of the file.
This is not equivalent to the python DetachedTimestamp structure,
which don’t encode/decode the magic and version.
The Python version is equivalent to VersionedProof<DetachedTimestamp>.
Implementations§
Source§impl<A: Allocator> DetachedTimestamp<A>
impl<A: Allocator> DetachedTimestamp<A>
Sourcepub fn header(&self) -> &DigestHeader
pub fn header(&self) -> &DigestHeader
Returns the digest header.
Sourcepub fn into_parts(self) -> (DigestHeader, Timestamp<A>)
pub fn into_parts(self) -> (DigestHeader, Timestamp<A>)
Consumes the detached timestamp and returns its parts.
Source§impl<A: Allocator + Clone> DetachedTimestamp<A>
impl<A: Allocator + Clone> DetachedTimestamp<A>
Sourcepub fn from_parts(header: DigestHeader, timestamp: Timestamp<A>) -> Self
pub fn from_parts(header: DigestHeader, timestamp: Timestamp<A>) -> Self
Creates a new detached timestamp from the given header and timestamp.
§Panics
Panics if the timestamp cannot be finalized with the given header’s digest.
Sourcepub fn try_from_parts(
header: DigestHeader,
timestamp: Timestamp<A>,
) -> Result<Self, FinalizationError>
pub fn try_from_parts( header: DigestHeader, timestamp: Timestamp<A>, ) -> Result<Self, FinalizationError>
Creates a new detached timestamp from the given header and timestamp.
Returns an error if the timestamp cannot be finalized with the given header’s digest.
Sourcepub fn finalize(&self)
pub fn finalize(&self)
Finalize the detached timestamp’s timestamp with the header’s digest.
§Panics
Panics if the timestamp cannot be finalized.
Sourcepub fn try_finalize(&self) -> Result<(), FinalizationError>
pub fn try_finalize(&self) -> Result<(), FinalizationError>
Tries to finalize the detached timestamp’s timestamp with the header’s digest.
Returns an error if the timestamp cannot be finalized.
Methods from Deref<Target = 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.
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.
Trait Implementations§
Source§impl<A: Clone + Allocator> Clone for DetachedTimestamp<A>
impl<A: Clone + Allocator> Clone for DetachedTimestamp<A>
Source§fn clone(&self) -> DetachedTimestamp<A>
fn clone(&self) -> DetachedTimestamp<A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<A: Allocator + Clone> DecodeIn<A> for DetachedTimestamp<A>
impl<A: Allocator + Clone> DecodeIn<A> for DetachedTimestamp<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.