std::buffer
In the in-tree stdlib, std::buffer provides a packed byte buffer
(BufferU8) plus width-oriented scalar buffer aliases built on
std::vector::Vector(T) (for example BufferI32).
Full reference: buffer.
Importing#
import std::buffer;
Example: BufferU8#
import std::buffer;
fn main () -> int {
match (BufferU8.init(4)) {
Ok(buffer) => {
let mut b: BufferU8 = buffer;
b.push(1 as u8);
b.push(2 as u8);
if b.pop() != Some(2 as u8) {
b.drop();
return 1;
}
b.drop();
return 0;
},
Err(_) => {
return 1;
},
}
}
See also#
Source repository · Edit this page · View Markdown