Struct SizeHint

pub struct SizeHint { /* private fields */ }

A Body size hint

The default implementation returns:

Implementations

impl SizeHint

fn new() -> SizeHint

Returns a new SizeHint with default values

fn with_exact(value: u64) -> SizeHint

Returns a new SizeHint with both upper and lower bounds set to the given value.

fn lower(&self) -> u64

Returns the lower bound of data that the Body will yield before completing.

fn set_lower(&mut self, value: u64)

Set the value of the lower hint.

Panics

The function panics if value is greater than upper.

fn upper(&self) -> Option<u64>

Returns the upper bound of data the Body will yield before completing, or None if the value is unknown.

fn set_upper(&mut self, value: u64)

Set the value of the upper hint value.

Panics

This function panics if value is less than lower.

fn exact(&self) -> Option<u64>

Returns the exact size of data that will be yielded if the lower and upper bounds are equal.

fn set_exact(&mut self, value: u64)

Set the value of the lower and upper bounds to exactly the same.

Trait Implementations

impl Add for SizeHint

type Output = SizeHint;
fn add(self, rhs: Self) -> Self::Output

impl Clone for SizeHint

fn clone(&self) -> SizeHint

impl Copy for SizeHint

impl Debug for SizeHint

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

impl Default for SizeHint

fn default() -> SizeHint

Auto Trait Implementations

impl Freeze for SizeHint

impl RefUnwindSafe for SizeHint

impl Send for SizeHint

impl Sync for SizeHint

impl Unpin for SizeHint

impl UnsafeUnpin for SizeHint

impl UnwindSafe for SizeHint

Blanket Implementations

impl<T> Any for SizeHint where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for SizeHint where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for SizeHint where T: ?Sized,

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

impl<T> CloneToUninit for SizeHint where T: Clone,

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

impl<T> From<T> for SizeHint

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for SizeHint where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for SizeHint where U: From<T>,

fn into(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<U> for SizeHint where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for SizeHint where U: TryFrom<T>,

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