NonEmpty
vector implementation, ensure non-emptiness by construction.
Inherits Vec
's immutable methods through Deref
trait, not implements DerefMut
.
The differences from Vec
:
len
returnsNonZeroUsize
,is_empty
always returnsfalse
.first(_mut)
,last(_mut)
,split_first(_mut)
,split_last(_mut)
don't returnOption
.pop
returnsNone
if there is only one element in it.
More usages please look at the embedded unit testing.