SequenceHint

Trait SequenceHint 

Source
pub trait SequenceHint: Sized + Sealed {
    // Required method
    fn get(self) -> Option<usize>;

    // Provided methods
    fn require<C>(self, cx: C) -> Result<usize, C::Error>
       where C: Context { ... }
    fn size_hint(self) -> SizeHint { ... }
}
Expand description

A size hint passed in when encoding or decoding a sequence.

Required Methods§

Source

fn get(self) -> Option<usize>

Get an optional sequence hint.

Provided Methods§

Source

fn require<C>(self, cx: C) -> Result<usize, C::Error>
where C: Context,

Require a sequence hint or raise an error indicating that the format doesn’t support sequences of unknown size if one is not present.

Source

fn size_hint(self) -> SizeHint

Coerce into a [SizeHint].

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SequenceHint for Option<usize>

Source§

fn get(self) -> Option<usize>

Source§

impl SequenceHint for usize

Source§

fn get(self) -> Option<usize>

Source§

fn require<C>(self, _: C) -> Result<usize, C::Error>
where C: Context,

Source§

fn size_hint(self) -> SizeHint

Implementors§