Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrkiven/list
:telescope: :smoking: A singly-linked stack like list support peek.
https://github.com/mrkiven/list
crate list rust
Last synced: 3 months ago
JSON representation
:telescope: :smoking: A singly-linked stack like list support peek.
- Host: GitHub
- URL: https://github.com/mrkiven/list
- Owner: MrKiven
- License: mit
- Created: 2017-05-26T14:11:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-30T14:21:27.000Z (over 7 years ago)
- Last Synced: 2024-10-13T17:23:28.176Z (3 months ago)
- Topics: crate, list, rust
- Language: Rust
- Homepage: https://docs.rs/list
- Size: 16.6 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# list
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Build Status](https://travis-ci.org/MrKiven/list.svg?branch=master)](https://travis-ci.org/MrKiven/list)
[![crates.io](https://img.shields.io/crates/v/list.svg)](https://crates.io/crates/list)
[![doc.rs](https://docs.rs/list/badge.svg)](https://docs.rs/list)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
```rust
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](LICENSE)