pub struct MemoryLayout {
pub string_offsets: HashMap<String, u32>,
pub next_string_offset: u32,
pub bytes_offsets: HashMap<Vec<u8>, u32>,
pub next_bytes_offset: u32,
pub set_id_counter: u32,
pub object_heap_offset: u32,
pub next_object_id: u32,
}Expand description
Memory layout information for string and object storage
Fields§
§string_offsets: HashMap<String, u32>§next_string_offset: u32§bytes_offsets: HashMap<Vec<u8>, u32>§next_bytes_offset: u32§set_id_counter: u32§object_heap_offset: u32§next_object_id: u32Implementations§
Source§impl MemoryLayout
impl MemoryLayout
pub fn new() -> Self
Sourcepub fn add_string(&mut self, s: &str) -> u32
pub fn add_string(&mut self, s: &str) -> u32
Add a string to memory and return its offset
Sourcepub fn allocate_object(&mut self, size: u32) -> u32
pub fn allocate_object(&mut self, size: u32) -> u32
Allocate space for an object instance, returns pointer to allocated memory
Sourcepub fn allocate_list(&mut self, element_count: u32) -> u32
pub fn allocate_list(&mut self, element_count: u32) -> u32
Allocate space for a list, returns pointer to allocated memory
Trait Implementations§
Source§impl Clone for MemoryLayout
impl Clone for MemoryLayout
Source§fn clone(&self) -> MemoryLayout
fn clone(&self) -> MemoryLayout
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryLayout
impl Debug for MemoryLayout
Auto Trait Implementations§
impl Freeze for MemoryLayout
impl RefUnwindSafe for MemoryLayout
impl Send for MemoryLayout
impl Sync for MemoryLayout
impl Unpin for MemoryLayout
impl UnwindSafe for MemoryLayout
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more