IncludeDirVfs

Struct IncludeDirVfs 

Source
pub struct IncludeDirVfs { /* private fields */ }
Expand description

A Vfs implementation with an include_dir::Dir directory.

Implementations§

Source§

impl IncludeDirVfs

Source

pub fn new(dir: Dir<'static>) -> Self

Creates a new IncludeDirVfs.

Trait Implementations§

Source§

impl<'vfs> Vfs<'vfs> for IncludeDirVfs

Source§

type DirWalk<'a> = IncludeDirWalker<'a> where Self: 'a, 'vfs: 'a

The type of the directory walker returned by the walk_dir method. Read more
Source§

type RFile = Cursor<&'static [u8]>

The type of the file returned by the open_read method. This allows us to read a file in chunks, which might be required for some certain file formats. Read more
Source§

fn open_read(self: Pin<&Self>, path: &Path) -> VfsResult<Self::RFile, Self>

Opens a file for reading, at the specified path.
Source§

fn read(self: Pin<&Self>, path: &Path) -> VfsResult<Vec<u8>, Self>

Reads the contents of a file, at the specified path. This is a core method that all other read methods are built upon, except for the ones that read via open_read and RFile.
Source§

fn read_string(self: Pin<&Self>, path: &Path) -> VfsResult<String, Self>

Reads the contents of a file, at the specified path, and returns it as a string. Read more
Source§

fn exists(self: Pin<&Self>, path: &Path) -> VfsResult<bool, Self>

Checks if a file exists at the specified path.
Source§

fn is_dir(self: Pin<&Self>, path: &Self::Path) -> VfsResult<bool, Self>

Checks if a directory exists at the specified path.
Source§

fn walk_dir<'b>( self: Pin<&'b Self>, path: &Path, ) -> VfsResult<Self::DirWalk<'b>, Self>
where 'vfs: 'b,

Walks a directory at the specified path, returning a stream of directory entries. Read more
Source§

impl VfsCore for IncludeDirVfs

Source§

type Path = Path

The path type used to represent paths in this virtual file system.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DirStructureItem for T

Source§

fn read( path: impl AsRef<<FsVfs as VfsCore>::Path>, ) -> Result<Self, Error<<<FsVfs as VfsCore>::Path as PathType>::OwnedPath>>
where Self: Sized + ReadFrom<'static, FsVfs>,

Uses the ReadFrom implementation to read the structure from disk, from the specified path.
Source§

fn write<'a, 'vfs>( &'a self, path: impl AsRef<<FsVfs as VfsCore>::Path>, ) -> Result<(), Error<<<FsVfs as VfsCore>::Path as PathType>::OwnedPath>>
where 'vfs: 'a, Self: WriteTo<'vfs, FsVfs>,

Uses the WriteTo implementation to write the structure to disk at the specified path.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<'vfs, V> VfsExt<'vfs> for V
where V: Vfs<'vfs> + ?Sized,

Source§

fn read_typed_pinned<T>( self: Pin<&'vfs Self>, path: impl AsRef<Self::Path>, ) -> Result<T, Error<<Self::Path as PathType>::OwnedPath>>
where T: ReadFrom<'vfs, Self>,

Reads a file / directory at the specified path, and parses it into the specified type using its ReadFrom implementation. Read more
Source§

fn read_typed<T>( &'vfs self, path: impl AsRef<Self::Path>, ) -> Result<T, Error<<Self::Path as PathType>::OwnedPath>>
where T: ReadFrom<'vfs, Self>, Self: Unpin,

Reads a file / directory at the specified path, and parses it into the specified type using its ReadFrom implementation. Read more