Skip to main content

EntryBuilder

Struct EntryBuilder 

Source
pub struct EntryBuilder<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, State: State = Empty> { /* private fields */ }
Expand description

Use builder syntax to set the inputs and finish with build().

Implementations§

Source§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, State: State> EntryBuilder<MCL, MCC, MPL, N, S, PD, State>

Source

pub fn build(self) -> Entry<MCL, MCC, MPL, N, S, PD>
where State: IsComplete,

Finish building and return the requested object

Source

pub fn namespace_id( self, value: N, ) -> EntryBuilder<MCL, MCC, MPL, N, S, PD, SetNamespaceId<State>>

Required.

Source

pub fn subspace_id( self, value: S, ) -> EntryBuilder<MCL, MCC, MPL, N, S, PD, SetSubspaceId<State>>

Required.

Source

pub fn path( self, value: Path<MCL, MCC, MPL>, ) -> EntryBuilder<MCL, MCC, MPL, N, S, PD, SetPath<State>>

Required.

Source

pub fn timestamp( self, value: impl Into<Timestamp>, ) -> EntryBuilder<MCL, MCC, MPL, N, S, PD, SetTimestamp<State>>

Required.

Source

pub fn payload_length( self, value: u64, ) -> EntryBuilder<MCL, MCC, MPL, N, S, PD, SetPayloadLength<State>>

Required.

Source

pub fn payload_digest( self, value: PD, ) -> EntryBuilder<MCL, MCC, MPL, N, S, PD, SetPayloadDigest<State>>

Required.

Source§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, State: State> EntryBuilder<MCL, MCC, MPL, N, S, PD, State>

Source

pub fn now( self, ) -> Result<EntryBuilder<MCL, MCC, MPL, N, S, PD, SetTimestamp<State>>, HifitimeError>

Sets the timestamp of the entry being built to the current time.

Source

pub fn payload<Payload, H, Digest>( self, payload: Payload, ) -> EntryBuilder<MCL, MCC, MPL, N, S, PD, SetPayloadLength<SetPayloadDigest<State>>>
where Payload: AsRef<[u8]>, H: Default + Hasher<Digest>, Digest: Into<PD>,

Sets the payload_length and payload_digest of the entry being built to those of the given Payload.

The type parameter H is the type of the Hasher which hashes the payload into a payload digest (of type Digest: Into<PD>). Its Default impl provides the initial state of the hasher.

Source

pub async fn payload_async<P, H, Digest>( self, payload_producer: &mut P, ) -> Result<EntryBuilder<MCL, MCC, MPL, N, S, PD, SetPayloadLength<SetPayloadDigest<State>>>, P::Error>
where P: BulkProducer<Item = u8, Final = ()>, H: Default + Hasher<Digest>, Digest: Into<PD>,

Sets the payload_length and payload_digest of the entry being built to those of the payload given by the producer.

The type parameter H is the type of the Hasher which hashes the payload into a payload digest (of type Digest: Into<PD>). Its Default impl provides the initial state of the hasher.

Auto Trait Implementations§

§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, State = Empty> !Freeze for EntryBuilder<MCL, MCC, MPL, N, S, PD, State>

§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, State> RefUnwindSafe for EntryBuilder<MCL, MCC, MPL, N, S, PD, State>

§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, State> Send for EntryBuilder<MCL, MCC, MPL, N, S, PD, State>
where N: Send, S: Send, PD: Send,

§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, State> Sync for EntryBuilder<MCL, MCC, MPL, N, S, PD, State>
where N: Sync, S: Sync, PD: Sync,

§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, State> Unpin for EntryBuilder<MCL, MCC, MPL, N, S, PD, State>
where N: Unpin, S: Unpin, PD: Unpin,

§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, State> UnsafeUnpin for EntryBuilder<MCL, MCC, MPL, N, S, PD, State>

§

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, State> UnwindSafe for EntryBuilder<MCL, MCC, MPL, N, S, PD, State>
where N: UnwindSafe, S: UnwindSafe, PD: UnwindSafe,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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.