Crates.io | lists |
lib.rs | lists |
version | 2.3.0 |
source | src |
created_at | 2022-01-31 04:09:27.472744 |
updated_at | 2022-02-07 07:04:49.734727 |
description | Library containing implementations of various sequential data-structures. |
homepage | |
repository | https://github.com/c1m50c/lists |
max_upload_size | |
id | 524370 |
size | 57,235 |
Library containing implementations of various sequential data-structures.
$ cd lists
$ cargo test
...
# If things go well during the tests you should see `ok` as the test result.
DoublyLinkedList
Sumuse lists::dl_list;
/// Creates a new `DoublyLinkedList`, and then adds all elements together into a sum.
fn main() {
let list = dl_list![1, 2, 3, 4, 5];
let sum = list.into_iter().sum::<i32>();
assert_eq!(sum, 15);
}
SinglyLinkedList
Sumuse lists::sl_list;
/// Creates a new `SinglyLinkedList`, and then adds all elements together into a sum.
fn main() {
let list = sl_list![1, 2, 3, 4, 5];
let sum = list.into_iter().sum::<i32>();
assert_eq!(sum, 15);
}