pub struct Page { /* private fields */ }
Expand description
Page is a wrapper for a single page of memory providing some helpful helpers for quick access.
Implementations§
Source§impl Page
impl Page
pub fn new(data: [u8; 4096]) -> Page
Sourcepub fn write_value_at_offset(
&mut self,
offset: usize,
value: usize,
) -> Result<(), Error>
pub fn write_value_at_offset( &mut self, offset: usize, value: usize, ) -> Result<(), Error>
write_value_at_offset writes a given value (as BigEndian) at a certain offset overriding values at that offset.
Sourcepub fn get_value_from_offset(&self, offset: usize) -> Result<usize, Error>
pub fn get_value_from_offset(&self, offset: usize) -> Result<usize, Error>
get_value_from_offset Fetches a value calculated as BigEndian, sized to usize. This function may error as the value might not fit into a usize.
Sourcepub fn insert_bytes_at_offset(
&mut self,
bytes: &[u8],
offset: usize,
end_offset: usize,
size: usize,
) -> Result<(), Error>
pub fn insert_bytes_at_offset( &mut self, bytes: &[u8], offset: usize, end_offset: usize, size: usize, ) -> Result<(), Error>
insert_bytes_at_offset pushes #size bytes from offset to end_offset inserts #size bytes from given slice.
Sourcepub fn write_bytes_at_offset(
&mut self,
bytes: &[u8],
offset: usize,
size: usize,
) -> Result<(), Error>
pub fn write_bytes_at_offset( &mut self, bytes: &[u8], offset: usize, size: usize, ) -> Result<(), Error>
write_bytes_at_offset write bytes at a certain offset overriding previous values.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Page
impl RefUnwindSafe for Page
impl Send for Page
impl Sync for Page
impl Unpin for Page
impl UnwindSafe for Page
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more