Crate holds[−][src]
This small library provides the Holds
trait, which can be
implemented for a type that contains another value. This trait is meant for
"Range"-like types. Obviously Rust's Range*
types fit this definition,
but slices like [T]
and str
do too (they contain a starting reference
and a length, and contain a number of subslices or discrete values in
between their start and end points).
Holds
exposes the holds
method, which returns a bool
representing whether the value was held within. This library also provides
the Reassign
trait, which is a subtrait of Holds
.
Reassign
is intended soley for references, so that the lifetime of a
value reference can be extended if it's held by a container that lives
longer. reassign
therefore takes &'a self
and &'b T
and returns
Option
<
&'a T
>
.
Traits
Holds | |
Reassign |