Struct obstack::Obstack
[−]
[src]
pub struct Obstack<A = usize> { /* fields omitted */ }
An obstack
Methods
impl<A> Obstack<A>
[src]
fn with_initial_capacity(initial_capacity: usize) -> Self
[src]
Constructs a new Obstack
with the specified initial capacity.
The obstack will be able to allocate at least initial_capacity
bytes before having to
allocate again.
fn new() -> Self
[src]
Constructs a new Obstack
.
The initial capacity will be set to DEFAULT_INITIAL_CAPACITY
.
fn push<'a, T>(&'a self, value: T) -> Ref<'a, T>
[src]
Pushes a value to the Obstack
.
Returns a Ref
that can be dereferenced to the value's location on the stack.
let r: Ref<String> = stack.push(String::from("Hello World!")); assert_eq!(*r, "Hello World!");
fn push_copy<'a, T>(&'a self, value: T) -> &'a mut T where
T: Copy,
[src]
T: Copy,
Pushes a Copy
value to the Obstack
.
Returns a mutable reference to the value on the stack.
let r: &mut [u8; 5] = stack.push_copy([1,2,3,4,5]); assert_eq!(*r, [1,2,3,4,5]);