Struct jenga::Frame
[−]
[src]
pub struct Frame<'a> { /* fields omitted */ }
An allocation Frame.
Data can be allocated using:
place
which allocates b bytes of type T and returns a mutable view to it.place_raw
if you really want unsafe code.place_iter
will drain the given iterator and return a mutable view to the data.cursor
gives you a gowing buffer that supportsio::Write
.writer
does the same, but supportsfmt::Write
and is can be turned into&str
All returned buffers are valid for the lifetime of the Frame
.
Methods
impl<'a> Frame<'a>
[src]
pub fn from_slice(s: &'a mut [u8]) -> Frame<'a>
[src]
Turn a slice of memory into an allocator Frame.
pub fn try_place<T>(
&mut self,
count: usize
) -> Result<FArray<'a, T>, OutOfMemory> where
T: Default,
[src]
&mut self,
count: usize
) -> Result<FArray<'a, T>, OutOfMemory> where
T: Default,
Allocate count
elements of T
.
Returns OutOfMemory
if there is not enough space left.
pub fn place<T>(&mut self, count: usize) -> FArray<'a, T> where
T: Default,
[src]
T: Default,
allocate count
elements of T
.
panics if there is not enough space left.
pub fn put<T>(&mut self, t: T) -> FBox<'a, T>
[src]
pub unsafe fn try_place_raw<T>(
&mut self,
count: usize
) -> Result<NonNull<T>, OutOfMemory>
[src]
&mut self,
count: usize
) -> Result<NonNull<T>, OutOfMemory>
Allocate count
elements of T
.
Returns OutOfMemory
if there is not enough space left.
The caller has to ensure the data does not outlife the Frame
pub unsafe fn place_raw<T>(&mut self, count: usize) -> *mut T
[src]
Allocate count
elements of T
.
panics if there is not enough space left.
The caller has to ensure the data does not outlife the Frame
pub fn place_iter<I, T>(
&mut self,
iter: I
) -> Result<FArray<'a, T>, OutOfMemory> where
I: Iterator<Item = T>,
[src]
&mut self,
iter: I
) -> Result<FArray<'a, T>, OutOfMemory> where
I: Iterator<Item = T>,
Drain the provided Iterator and return the resulting data. The iterator may not use the stack allocator. panics if the iterator attempts to use the stack allocator.
pub fn subframe(&mut self) -> Frame
[src]
Create a subframe. All allocations that happen within it, will be reset when it goes out if scope.
ⓘImportant traits for Cursor<'a, 'b>pub fn cursor<'b>(&'b mut self) -> Cursor<'a, 'b>
[src]
Create a growing Buffer that supports io::Write
call finish()
on the buffer to complete it.
pub fn writer<'b>(&'b mut self) -> Writer<'a, 'b>
[src]
Create a growing Buffer that supports fmt::Write
call finish()
on the buffer to complete it.