pub trait Length {
// Required method
fn len(&self) -> usize;
// Provided method
fn is_empty(&self) -> bool { ... }
}
Expand description
Trait implemented for types that have a length as required by the
Input::Slice
associated type.
Required Methods§
sourcefn len(&self) -> usize
fn len(&self) -> usize
Returns the length of self
.
While the units of length are unspecified, the returned value must be
consistent with the use of n
in the Input::slice()
method. In
particular, if Input::slice(n)
returns Some(x)
, then x.len()
must return n
.