MapHint

Trait MapHint 

Source
pub trait MapHint: 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 map.

Required Methods§

Source

fn get(self) -> Option<usize>

Get an optional map hint.

Provided Methods§

Source

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

Require a map hint or raise an error indicating that the format doesn’t support maps 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 MapHint for Option<usize>

Source§

fn get(self) -> Option<usize>

Source§

impl MapHint 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§