Crates.io | non-empty-vec |
lib.rs | non-empty-vec |
version | 0.2.3 |
source | src |
created_at | 2019-12-15 06:36:20.64124 |
updated_at | 2021-11-16 16:38:54.60629 |
description | `NonEmpty` vector implementation, ensure non-emptiness by construction. |
homepage | |
repository | https://github.com/yihuang/non-empty-vec |
max_upload_size | |
id | 189510 |
size | 12,508 |
NonEmpty
vector implementation, ensure non-emptiness by construction.
Inherits Vec
's immutable methods through Deref
trait, not implements DerefMut
.
The differences from Vec
:
len
returns NonZeroUsize
, is_empty
always returns false
.first(_mut)
, last(_mut)
, split_first(_mut)
, split_last(_mut)
don't return Option
.pop
returns None
if there is only one element in it.More usages please look at the embedded unit testing.