Skip to main content

SliceStreamProducer

Struct SliceStreamProducer 

Source
pub struct SliceStreamProducer<P>
where P: BulkProducer<Item = u8>,
{ /* private fields */ }
Expand description

A BulkProducer<Item=u8> produced by a DropDecoder, which produces the verifiable slice stream for one contiguous slice of the payload of one AuthorisedEntry decoded from the Willow Drop Format.

§Warning

Any SliceStreamProducer produced by a DropDecoder must be completely consumed, emitting its Final value in order for further calls to DropDecoder::produce to make progress.

Trait Implementations§

Source§

impl<P> BulkProducer for SliceStreamProducer<P>
where P: BulkProducer<Item = u8>,

Source§

async fn expose_items_gracefully<F, R>( &mut self, f: F, ) -> Result<Either<R, (F, Self::Final)>, (F, Self::Error)>
where F: AsyncFnOnce(&[Self::Item]) -> (usize, R),

Exposes a non-empty number of items to a given async function, the function then reports to the producer how many items should now be considered produced. Read more
Source§

impl<P> Producer for SliceStreamProducer<P>
where P: BulkProducer<Item = u8>,

Source§

type Item = <P as Producer>::Item

The sequence produced by this producer starts with arbitrarily many values of this type.
Source§

type Final = ()

The sequence produced by this producer ends with up to one value of this type.
Source§

type Error = DecodeError<(), <P as Producer>::Error, Blame>

The type of errors the producer can emit instead of doing its job.
Source§

async fn produce( &mut self, ) -> Result<Either<Self::Item, Self::Final>, Self::Error>

Attempts to produce the next item, which is either a regular repeated item or the final value. The method may fail, returning an Err instead. Read more
Source§

async fn slurp(&mut self) -> Result<(), Self::Error>

Attempts to perform any effectful actions that might make future calls to produce and bulk_produce more efficient. Read more

Auto Trait Implementations§

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<P> BulkProducerExt for P
where P: BulkProducer + ?Sized,

Source§

async fn expose_items<F, R>( &mut self, f: F, ) -> Result<Either<R, Self::Final>, Self::Error>
where F: AsyncFnOnce(&[Self::Item]) -> (usize, R),

Behaves exactly like BulkProducer::expose_items_gracefully, except that the provided function is not returned alongside error or final values for simplicity. Read more
Source§

async fn expose_items_sync<F, R>( &mut self, f: F, ) -> Result<Either<R, Self::Final>, Self::Error>
where F: FnOnce(&[Self::Item]) -> (usize, R),

Behaves exactly like BulkProducerExt::expose_items, except the function argument is not async. Read more
Source§

async fn bulk_produce( &mut self, buf: &mut [Self::Item], ) -> Result<Either<usize, Self::Final>, Self::Error>
where Self::Item: Clone,

Calls self.expose_items, clones the exposed items into buf, and returns how many items where written there. Alternatively, forwards any final value or error. This method is mostly analogous to std::io::Read::read. Read more
Source§

async fn bulk_overwrite_full_slice( &mut self, buf: &mut [Self::Item], ) -> Result<(), ProduceAtLeastError<Self::Final, Self::Error>>
where Self::Item: Clone,

Tries to completely overwrite a slice with items from a bulk producer. Reports an error if the slice could not be overwritten completely. Read more
Source§

async fn skip( &mut self, amount: usize, ) -> Result<(), ProduceAtLeastError<Self::Final, Self::Error>>

Produces and drops amount many items. Reports an error if the producer yielded fewer than amount many items. Read more
Source§

fn to_bulk_buffered<Q>( self, queue: Q, ) -> BulkBuffered<Self, Self::Final, Self::Error, Q>
where Self: Sized,

Turns self into a buffered bulk producer. Read more
Source§

async fn peek<F, R>( &mut self, f: F, ) -> Result<Either<R, Self::Final>, Self::Error>
where F: AsyncFnOnce(&Self::Item) -> R,

Calls the given async function with a reference to the next item that would be produced, but without actually producing it. Read more
Source§

async fn peek_sync<F, R>( &mut self, f: F, ) -> Result<Either<R, Self::Final>, Self::Error>
where F: FnOnce(&Self::Item) -> R,

Behaves exactly like BulkProducerExt::peek, except the function argument is not async. Read more
Source§

async fn produce_decoded<T>( &mut self, ) -> Result<T, DecodeError<Self::Final, Self::Error, <T as Decodable<Self::Item>>::ErrorReason>>
where T: Decodable<Self::Item>,

Decodes items into some Decodable type T. Read more
Source§

async fn produce_decoded_canonic<T>( &mut self, ) -> Result<T, DecodeError<Self::Final, Self::Error, <T as DecodableCanonic<Self::Item>>::ErrorCanonic>>
where T: DecodableCanonic<Self::Item>,

Canonically decodes items into some Decodable type T. Read more
Source§

async fn produce_relative_decoded<T, RelativeTo>( &mut self, rel: &RelativeTo, ) -> Result<T, DecodeError<Self::Final, Self::Error, <T as RelativeDecodable<RelativeTo, Self::Item>>::ErrorReason>>
where T: RelativeDecodable<RelativeTo, Self::Item>,

Source§

async fn produce_relative_decoded_canonic<T, RelativeTo>( &mut self, rel: &RelativeTo, ) -> Result<T, DecodeError<Self::Final, Self::Error, <T as RelativeDecodableCanonic<RelativeTo, Self::Item>>::ErrorCanonic>>
where T: RelativeDecodableCanonic<RelativeTo, Self::Item>,

Source§

async fn decode_u16_be( &mut self, ) -> Result<u16, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a u16 by internally producing its big-endian encoding from self. Read more
Source§

async fn decode_u32_be( &mut self, ) -> Result<u32, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a u32 by internally producing its big-endian encoding from self. Read more
Source§

async fn decode_u64_be( &mut self, ) -> Result<u64, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a u64 by internally producing its big-endian encoding from self. Read more
Source§

async fn decode_u128_be( &mut self, ) -> Result<u128, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a u128 by internally producing its big-endian encoding from self. Read more
Source§

async fn decode_i16_be( &mut self, ) -> Result<i16, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a i16 by internally producing its big-endian encoding from self. Read more
Source§

async fn decode_i32_be( &mut self, ) -> Result<i32, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a i32 by internally producing its big-endian encoding from self. Read more
Source§

async fn decode_i64_be( &mut self, ) -> Result<i64, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a i64 by internally producing its big-endian encoding from self. Read more
Source§

async fn decode_i128_be( &mut self, ) -> Result<i128, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a i128 by internally producing its big-endian encoding from self. Read more
Source§

async fn decode_u16_le( &mut self, ) -> Result<u16, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a u16 by internally producing its little-endian encoding from self. Read more
Source§

async fn decode_u32_le( &mut self, ) -> Result<u32, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a u32 by internally producing its little-endian encoding from self. Read more
Source§

async fn decode_u64_le( &mut self, ) -> Result<u64, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a u64 by internally producing its little-endian encoding from self. Read more
Source§

async fn decode_u128_le( &mut self, ) -> Result<u128, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a u128 by internally producing its little-endian encoding from self. Read more
Source§

async fn decode_i16_le( &mut self, ) -> Result<i16, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a i16 by internally producing its little-endian encoding from self. Read more
Source§

async fn decode_i32_le( &mut self, ) -> Result<i32, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a i32 by internally producing its little-endian encoding from self. Read more
Source§

async fn decode_i64_le( &mut self, ) -> Result<i64, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a i64 by internally producing its little-endian encoding from self. Read more
Source§

async fn decode_i128_le( &mut self, ) -> Result<i128, DecodeError<Self::Final, Self::Error, !>>
where Self: BulkProducer<Item = u8>,

Returns a i128 by internally producing its little-endian encoding from self. 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<P> IntoBulkProducer for P

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<P> IntoProducer for P
where P: Producer,

Source§

type Item = <P as Producer>::Item

The type of repeated items being produced.
Source§

type Final = <P as Producer>::Final

The type of the final value being produced.
Source§

type Error = <P as Producer>::Error

The type of errors the producer may emit.
Source§

type IntoProducer = P

The producer into which values of this type can be converted. Read more
Source§

fn into_producer(self) -> P

Creates a producer from a value. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P> ProducerExt for P
where P: Producer + ?Sized,

Source§

async fn produce_item( &mut self, ) -> Result<Self::Item, ProduceAtLeastError<Self::Final, Self::Error>>

Tries to produce a regular item, and reports an error if the final value was produced instead. Read more
Source§

async fn produce_final( &mut self, ) -> Result<Self::Final, ExpectedFinalError<Self::Item, Self::Error>>

Tries to produce a final value, and reports an error if a normal item was produced instead. Read more
Source§

async fn overwrite_full_slice( &mut self, buf: &mut [Self::Item], ) -> Result<(), ProduceAtLeastError<Self::Final, Self::Error>>

Tries to completely overwrite a slice with items from a producer. Reports an error if the slice could not be overwritten completely. Read more
Source§

fn to_buffered<Q>(self, queue: Q) -> Buffered<Self, Self::Final, Self::Error, Q>
where Self: Sized,

Turns self into a buffered bulk producer. Read more
Source§

fn to_map_error<Fun, NewErr>(self, fun: Fun) -> MapError<Self, Fun>
where Self: Sized, Fun: FnOnce(Self::Error) -> NewErr,

Turns self into a producer that maps any error emitted by self through the given function. Read more
Source§

fn to_map_async_error<Fun, NewErr>(self, fun: Fun) -> MapAsyncError<Self, Fun>
where Self: Sized, Fun: FnOnce(Self::Error) -> NewErr,

Turns self into a producer that maps any error emitted by self through the given async function. Read more
Source§

fn to_map_final<Fun, NewFin>(self, fun: Fun) -> MapFinal<Self, Fun>
where Self: Sized, Fun: FnOnce(Self::Final) -> NewFin,

Turns self into a producer that maps any final value emitted by self through the given function. Read more
Source§

fn to_map_async_final<Fun, NewFin>(self, fun: Fun) -> MapAsyncFinal<Self, Fun>
where Self: Sized, Fun: AsyncFnOnce(Self::Final) -> NewFin,

Turns self into a producer that maps any final value emitted by self through the given async function. Read more
Source§

fn to_map_item<Fun, NewItem>(self, fun: Fun) -> MapItem<Self, Fun>
where Self: Sized, Fun: FnMut(Self::Item) -> NewItem,

Turns self into a producer that maps any item emitted by self through the given function. Read more
Source§

fn to_map_async_item<Fun, NewItem>(self, fun: Fun) -> MapAsyncItem<Self, Fun>
where Self: Sized, Fun: AsyncFnMut(Self::Item) -> NewItem,

Turns self into a producer that maps any item emitted by self through the given async function. Read more
Source§

fn to_chain<P>(self, producer: P) -> Chain<Self, P>
where Self: Sized + Producer<Final = ()>, P: Producer<Item = Self::Item>,

Consumes self and the provided producer to create a producer which produces first the items of self, then the items of the chained producer. Read more
Source§

fn to_filter<P>(self, predicate: P) -> Filter<Self, P>
where Self: Sized, P: AsyncFnMut(&Self::Item) -> bool,

Turns self into a producer which only produces items for which the given predicate returns true. Read more
Source§

fn to_produce_while<P>(self, predicate: P) -> ProduceWhile<Self, P>
where Self: Sized, P: AsyncFnMut(&Self::Item) -> bool,

Wraps self and the provided predicate to create a producer which produces the items of self until an item is encountered for which the predicate returns false. Read more
Source§

fn to_limit(self, limit: usize) -> Limit<Self>
where Self: Sized,

Turns self into a producer that emits at most limit items. After producing limit items, the next call to produce yeilds a ProduceLimitError. Read more
Source§

fn to_stats(self) -> Stats<Self>
where Self: Sized,

Turns self into a producer whose progress can be queried. Read more
Source§

fn to_watch(self) -> Watch<Self>
where Self: Sized,

Turns self into a producer whose progress can be queried concurrently. Read more
Source§

async fn equals<P>(&mut self, other: &mut P) -> bool
where P: Producer<Item = Self::Item, Final = Self::Final, Error = Self::Error>, Self::Item: PartialEq, Self::Final: PartialEq,

Returns whether this producer and another producer emit equal sequences of items and final values. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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.