non-empty-vec

Crates.ionon-empty-vec
lib.rsnon-empty-vec
version0.2.3
sourcesrc
created_at2019-12-15 06:36:20.64124
updated_at2021-11-16 16:38:54.60629
description`NonEmpty` vector implementation, ensure non-emptiness by construction.
homepage
repositoryhttps://github.com/yihuang/non-empty-vec
max_upload_size
id189510
size12,508
yihuang (yihuang)

documentation

README

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.

Commit count: 25

cargo fmt