Skip to content

MrKiven/list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

list

License Build Status crates.io doc.rs

A singly-linked stack like list support peek.

Getting started

Installing

Add this to Cargo.toml file of your project:

[dependencies]
list = "~0.1.3"

Usage

extern crate list;

use list::List;

fn main() {
    let mut list = List::new();
    // Check empty list behaves right
    assert_eq!(list.pop(), None);

    // Populate list
    list.push(1);
    list.push(2);
    list.push(3);

    // Check normal removal
    assert_eq!(list.pop(), Some(3));
    assert_eq!(list.pop(), Some(2));

    // Push some more just to make sure nothing's corrupted
    list.push(4);
    list.push(5);

    // Check normal removal
    assert_eq!(list.pop(), Some(5));
    assert_eq!(list.pop(), Some(4));

    // Check exhaustion
    assert_eq!(list.pop(), Some(1));
    assert_eq!(list.pop(), None);
}

Run test

cargo test -v

LICENSE

MIT

About

🔭 🚬 A singly-linked stack like list support peek.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages