stacking

Crates.iostacking
lib.rsstacking
version0.2.5
sourcesrc
created_at2021-07-10 11:02:56.03305
updated_at2021-07-16 20:19:31.636773
descriptiona simple library for using a stack datastructure in rust
homepagehttps://gitlab.sokoll.com/moritz/stacking.rs
repositoryhttps://gitlab.sokoll.com/moritz/stacking.rs
max_upload_size
id421055
size50,406
Moritz Sokoll (ULUdev)

documentation

https://docs.rs/stacking

README

Stacking

pipeline status

stacking is a module containing tools for building stacks in rust

Stack

stacking comes with a Stack builtin. It only supports pop, push and len as actions

Examples

use stacking::stacks::Stack;
                                                                                                     
let mut stack: Stack<i32> = Stack::new();
assert_eq!(stack.len(), 0);
stack.push(4);
assert_eq!(stack.len(), 1);
assert_eq!(stack.pop(), Some(4));

This simple example creates a stack, appends 4 to it and pops it off again.

Nodes

stacking also contains a Node. A Node can be used to build custom stacks or other data structures with specific orders.

Examples

use stacking::nodes::Node;
                                                                                                     
let mut n1: Node<i32> = Node::new(None, None, 15);
let mut n2: Node<i32> = Node::new(None, Some(n1.clone()), 14);
assert_eq!(n1.val, 15);
assert_eq!(n2.val, 14);

This will create two nodes referencing each other to create an order in which after n2 comes n1.

Commit count: 0

cargo fmt