Skip to main content

Emitted

Struct Emitted 

Source
pub struct Emitted<'p> { /* private fields */ }
Expand description

What came out of a pipeline, and how it is framed.

bytes is the whole emission and units is the pieces the segment asked for it to be delivered in. Unless a stage called Ctx::boundary there is exactly one unit and the two say the same thing, so a sink with no framing of its own (a byte stream, a file) can write bytes in one call and ignore units entirely.

Where units are observable they matter: on a datagram sink one unit is one message, and across a detached boundary one unit is one parcel and so one call to the segment below.

Implementations§

Source§

impl<'p> Emitted<'p>

Source

pub const fn whole(bytes: &'p [u8]) -> Self

One unit covering all of bytes, which is what an unframed chunk is.

Source

pub const fn empty() -> Self

Nothing reached the end of the pipeline.

Source

pub const fn bytes(&self) -> &'p [u8]

Everything emitted, concatenated.

Source

pub const fn is_empty(&self) -> bool

Source

pub const fn len(&self) -> usize

Source

pub fn units(self) -> impl Iterator<Item = &'p [u8]>

Each unit, in order. Exactly one unit when nothing declared any.

Takes self by value so the iterator borrows the pipeline rather than this handle, which is what lets a caller iterate units while the emission is in flight.

Trait Implementations§

Source§

impl<'p> Clone for Emitted<'p>

Source§

fn clone(&self) -> Emitted<'p>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'p> Copy for Emitted<'p>

Source§

impl<'p> Debug for Emitted<'p>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'p> Freeze for Emitted<'p>

§

impl<'p> RefUnwindSafe for Emitted<'p>

§

impl<'p> Send for Emitted<'p>

§

impl<'p> Sync for Emitted<'p>

§

impl<'p> Unpin for Emitted<'p>

§

impl<'p> UnsafeUnpin for Emitted<'p>

§

impl<'p> UnwindSafe for Emitted<'p>

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