pub struct FileContentProvider<T> { /* private fields */ }Expand description
Loads scripts from the file system.
Paths without an extension get the configured one, and are canonicalized so the same file reached by two paths is recognised as one.
Implementations§
Source§impl<T> FileContentProvider<T>
impl<T> FileContentProvider<T>
Sourcepub fn new(
extension: impl ToString,
parser: impl BytesContentParser<T> + 'static,
) -> Self
pub fn new( extension: impl ToString, parser: impl BytesContentParser<T> + 'static, ) -> Self
Builds a provider for one extension and parser.
Trait Implementations§
Source§impl<T> ScriptContentProvider<T> for FileContentProvider<T>
impl<T> ScriptContentProvider<T> for FileContentProvider<T>
Source§fn load(&mut self, path: &str) -> Result<Option<T>, Box<dyn Error>>
fn load(&mut self, path: &str) -> Result<Option<T>, Box<dyn Error>>
Loads and parses one unit, or returns
None when there is nothing to
load.Source§fn sanitize_path(&self, path: &str) -> Result<String, Box<dyn Error>>
fn sanitize_path(&self, path: &str) -> Result<String, Box<dyn Error>>
Turns a path into the canonical form used to recognise the same unit
twice. Read more
Source§fn join_paths(
&self,
parent: &str,
relative: &str,
) -> Result<String, Box<dyn Error>>
fn join_paths( &self, parent: &str, relative: &str, ) -> Result<String, Box<dyn Error>>
Resolves an import path written inside
parent.Source§fn unpack_load(
&mut self,
path: &str,
) -> Result<Vec<ScriptContent<T>>, Box<dyn Error>>
fn unpack_load( &mut self, path: &str, ) -> Result<Vec<ScriptContent<T>>, Box<dyn Error>>
Loads a path that may hold several units, such as an archive. Read more
Auto Trait Implementations§
impl<T> !RefUnwindSafe for FileContentProvider<T>
impl<T> !Send for FileContentProvider<T>
impl<T> !Sync for FileContentProvider<T>
impl<T> !UnwindSafe for FileContentProvider<T>
impl<T> Freeze for FileContentProvider<T>
impl<T> Unpin for FileContentProvider<T>
impl<T> UnsafeUnpin for FileContentProvider<T>
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