#options #small-vec #set

few

A generalization of std::Option allowing for up to two optional values

7 releases

0.1.5 Jan 4, 2021
0.1.4 Jul 25, 2020
0.0.1 Jul 1, 2020

#11 in #small-vec

32 downloads per month
Used in normalize_interval

MIT/Apache

12KB
182 lines

Few

A generalization of std::Option allowing for up to two optional values.

This library provides a Few enum with three variants:

pub enum Few<T> {
    Zero,
    One(T),
    Two(T, T),
}

Very few methods are defined for it, and for most purposes, std::Option, std::Vec, or smallvec should be used instead. This library was developed to provide a data structure for pattern matching on the result of set-like intersect, union, and minus operations over contiguous ranges.

License

Few is licenced with the MIT license or the Apache version 2.0 license, at your option.


lib.rs:

A generalization of std::Option allowing for up to two optional values.

This library provides a Few enum with three variants:

pub enum Few<T> {
    Zero,
    One(T),
    Two(T, T),
}

Very few methods are defined for it, and for most purposes, std::Option, std::Vec, or smallvec should be used instead. This library was developed to provide a data structure for pattern matching on the result of set-like intersect, union, and minus operations over contiguous ranges.

Features

Feature Description
"serde" Enables serialization and deserialization of data using serde.

By default, there are no features enabled.

Dependencies

~170KB