Enum Needed

enum Needed

Contains information on needed data if a parser returned Incomplete

Note: This is only possible for Stream that are [partial]crate::stream::StreamIsPartial, like [Partial][crate::Partial].

Variants

Unknown

Needs more data, but we do not know how much

Size(core::num::NonZeroUsize)

Contains a lower bound on the buffer offset needed to finish parsing

For byte/&str streams, this translates to bytes

Implementations

impl Needed

fn new(s: usize) -> Self

Creates Needed instance, returns Needed::Unknown if the argument is zero

fn is_known(self: &Self) -> bool

Indicates if we know how many bytes we need

fn map<F: Fn(NonZeroUsize) -> usize>(self: Self, f: F) -> Needed

Maps a Needed to Needed by applying a function to a contained Size value.

impl Clone for Needed

fn clone(self: &Self) -> Needed

impl Copy for Needed

impl Debug for Needed

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

impl Eq for Needed

impl Freeze for Needed

impl PartialEq for Needed

fn eq(self: &Self, other: &Needed) -> bool

impl RefUnwindSafe for Needed

impl Send for Needed

impl StructuralPartialEq for Needed

impl Sync for Needed

impl Unpin for Needed

impl UnsafeUnpin for Needed

impl UnwindSafe for Needed

impl<T> Any for Needed

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Needed

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Needed

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Needed

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Needed

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Needed

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Needed

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Needed

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>