rust-immutable-seq
Contents
About
immutable-seq-rust
is a library providing an immutable sequence data structure for the Rust programming language.
The Seq
implements an API similar to Vec
, with the added advantage that previous versions of the data structure remain available and unchanged.
Usage
-
Add the dependency
immutable-seq
to yourCargo.toml
[] = "0.1.0"
-
Include the crate
immutable-seq
in your codeextern crate immutable_seq; use Seq;
(
#[macro_use]
is only required to enable theseq!
macro, shown below.)
Examples
-
Create a sequence with some values
let seq1: = seq!;
-
Add an element to the beginninng. Note: this creates a new sequence, with the element added, but does not change the original sequence.
let seq2 = seq1.push_front; assert_eq!; assert_eq!;