MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / basic

Function basic

publication/code/chapter04/stack.rs:118–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116 iter();
117
118 fn basic() {
119 let mut s = Stack::new();
120 s.push(1); s.push(2); s.push(3);
121
122 println!("size: {}, {:?}", s.len(), s);
123 println!("pop {:?}, size {}",s.pop().unwrap(), s.len());
124 println!("empty: {}, {:?}", s.is_empty(), s);
125
126 s.clear();
127 println!("{:?}", s);
128 }
129
130 fn peek() {
131 let mut s = Stack::new();

Callers 1

mainFunction · 0.70

Calls 2

pushMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected