pub struct RomFs<'a> { /* private fields */ }
Expand description
Represents a ROM Filing System (ROMFS), as backed by a byte slice in memory.
Implementations§
Source§impl<'a> RomFs<'a>
impl<'a> RomFs<'a>
Sourcepub fn new(contents: &'a [u8]) -> Result<RomFs<'a>, Error>
pub fn new(contents: &'a [u8]) -> Result<RomFs<'a>, Error>
Mount a ROMFS using a given block of RAM
Sourcepub fn find(&self, file_name: &str) -> Option<Entry<&str, &[u8]>>
pub fn find(&self, file_name: &str) -> Option<Entry<&str, &[u8]>>
Find a file in the ROMFS, by name.
Sourcepub fn construct<S, T>(
buffer: &mut [u8],
entries: &[Entry<S, T>],
) -> Result<usize, Error>
pub fn construct<S, T>( buffer: &mut [u8], entries: &[Entry<S, T>], ) -> Result<usize, Error>
Construct a ROMFS into the given buffer.
Tells you how many bytes it used of the given buffer.
The buffer must be large enough otherwise an error is returned - see
Self::size_required
to calculate the size of buffer required.
Trait Implementations§
Source§impl<'a> IntoIterator for &'a RomFs<'a>
impl<'a> IntoIterator for &'a RomFs<'a>
Source§impl<'a> IntoIterator for RomFs<'a>
impl<'a> IntoIterator for RomFs<'a>
Auto Trait Implementations§
impl<'a> Freeze for RomFs<'a>
impl<'a> RefUnwindSafe for RomFs<'a>
impl<'a> Send for RomFs<'a>
impl<'a> Sync for RomFs<'a>
impl<'a> Unpin for RomFs<'a>
impl<'a> UnwindSafe for RomFs<'a>
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