pub struct File<'a> { /* private fields */ }Expand description
A file with its contents stored in a &'static [u8].
Implementations§
Source§impl<'a> File<'a>
impl<'a> File<'a>
Sourcepub const fn new(path: &'a str, contents: &'a [u8], mimetype: &'a str) -> Self
pub const fn new(path: &'a str, contents: &'a [u8], mimetype: &'a str) -> Self
Create a new File.
Sourcepub fn path(&self) -> &'a Path
pub fn path(&self) -> &'a Path
The full path for this File, relative to the directory passed to
crate::include_directory!().
Sourcepub fn mimetype_as_string(&self) -> String
pub fn mimetype_as_string(&self) -> String
The file’s mimetype as a string.
Sourcepub fn contents_utf8(&self) -> Option<&str>
pub fn contents_utf8(&self) -> Option<&str>
The file’s contents interpreted as a string.
Trait Implementations§
impl<'a> Eq for File<'a>
impl<'a> StructuralPartialEq for File<'a>
Auto Trait Implementations§
impl<'a> Freeze for File<'a>
impl<'a> RefUnwindSafe for File<'a>
impl<'a> Send for File<'a>
impl<'a> Sync for File<'a>
impl<'a> Unpin for File<'a>
impl<'a> UnwindSafe for File<'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