pub trait SizableContainer {
// Required methods
fn at_capacity(&self) -> bool;
fn ensure_capacity(&mut self, stash: &mut Option<Self>)
where Self: Sized;
}
Expand description
A container that can be sized and reveals its capacity.
Required Methods§
Sourcefn at_capacity(&self) -> bool
fn at_capacity(&self) -> bool
Indicates that the container is “full” and should be shipped.
Sourcefn ensure_capacity(&mut self, stash: &mut Option<Self>)where
Self: Sized,
fn ensure_capacity(&mut self, stash: &mut Option<Self>)where
Self: Sized,
Restores self
to its desired capacity, if it has one.
The stash
argument is available, and may have the intended capacity.
However, it may be non-empty, and may be of the wrong capacity. The
method should guard against these cases.
Assume that the stash
is in an undefined state, and properly clear it
before re-using it.