pub trait Source {
type Item;
// Required method
fn next(&mut self) -> Self::Item;
// Provided method
fn size_hint(&self) -> (usize, Option<usize>) { ... }
}Expand description
This trait allows receiving items from somewhere.
Types implementing this trait are called “sources”.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Get an estimation of the number of items yet to be received.
Returns a tuple where the 2 elements are the lower and upper bounds of the number
of items expected to be received. The upper bound is an Option<usize> to account
for cases where the upper bound is not known. In such cases, implementations should
return None as the upper bound.
The default implementation returns (0, None).