Struct gbfs::GBFSFilesystem
source · #[repr(align(4))]#[repr(C)]pub struct GBFSFilesystem<'a> { /* private fields */ }Expand description
A filesystem that files can be read from.
Implementations§
source§impl<'a> GBFSFilesystem<'a>
impl<'a> GBFSFilesystem<'a>
sourcepub const fn from_slice(data: &'a [u8]) -> Result<GBFSFilesystem<'a>, GBFSError>
pub const fn from_slice(data: &'a [u8]) -> Result<GBFSFilesystem<'a>, GBFSError>
Constructs a new filesystem from a GBFS-formatted byte slice.
To make lifetime management easier it’s probably a good idea to use a slice with a static lifetime here.
It’s also a good idea to ensure this function is called at compile time with a const argument,
to avoid having to store the filesystem index in RAM.
sourcepub fn get_file_data_by_name(
&self,
str_name: &str
) -> Result<&'a [u8], GBFSError>
pub fn get_file_data_by_name(
&self,
str_name: &str
) -> Result<&'a [u8], GBFSError>
Returns a reference to the file data as a slice of u8’s.
An error is returned if the file does not exist or the filename is invalid.
All filenames longer than FILENAME_LEN characters are invalid.
sourcepub fn get_file_data_by_name_as_u16_slice(
&self,
name: &str
) -> Result<&'a [u16], GBFSError>
pub fn get_file_data_by_name_as_u16_slice(
&self,
name: &str
) -> Result<&'a [u16], GBFSError>
Returns a reference to the file data as a slice of u32’s. An error is returned if the file does not exist, it’s length is not a multiple of 2 or the filename is invalid. All filenames longer than 24 characters are invalid.
sourcepub fn get_file_data_by_name_as_u32_slice(
&self,
name: &str
) -> Result<&'a [u32], GBFSError>
pub fn get_file_data_by_name_as_u32_slice(
&self,
name: &str
) -> Result<&'a [u32], GBFSError>
Returns a reference to the file data as a slice of u32’s. An error is returned if the file does not exist, it’s length is not a multiple of 4 or the filename is invalid. All filenames longer than 24 characters are invalid.
Trait Implementations§
source§impl<'a> Clone for GBFSFilesystem<'a>
impl<'a> Clone for GBFSFilesystem<'a>
source§fn clone(&self) -> GBFSFilesystem<'a>
fn clone(&self) -> GBFSFilesystem<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more