Bounds
Just like generic types can be bounded, lifetimes (themselves generic)
use bounds as well. The :
character has a slightly different meaning here,
but +
is the same. Note how the following read:
T: 'a
: All references inT
must outlive lifetime'a
.T: Trait + 'a
: TypeT
must implement traitTrait
and all references inT
must outlive'a
.
The example below shows the above syntax in action used after keyword where
:
See also:
generics, bounds in generics, and multiple bounds in generics