immutable-seq

Crates.ioimmutable-seq
lib.rsimmutable-seq
version0.1.2
sourcesrc
created_at2017-02-12 05:33:40.373937
updated_at2017-02-12 07:42:33.768377
descriptionImmutable sequence data structure
homepage
repositoryhttps://github.com/bjoeris/rust-immutable-seq
max_upload_size
id8481
size97,356
(bjoeris)

documentation

https://docs.rs/immutable-seq

README

rust-immutable-seq

Contents

API Docs

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 your Cargo.toml

    [dependencies]
    immutable-seq = "0.1.0"
    
  • Include the crate immutable-seq in your code

    #[macro_use]
    extern crate immutable_seq;
    
    use immutable_seq::Seq;
    

    (#[macro_use] is only required to enable the seq! macro, shown below.)

Examples

  • Create a sequence with some values

    let seq1: Seq<i32> = seq![1, 2, 3];
    
  • 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(0);
    assert_eq!(seq1, seq![1, 2, 3]);
    assert_eq!(seq2, seq![0, 1, 2, 3]);
    
Commit count: 24

cargo fmt