pub struct ExtensionContentProvider<S> { /* private fields */ }Expand description
Dispatches to another provider based on the file extension.
Lets one package mix source formats, for example a text language importing a serialized module.
Implementations§
Source§impl<S> ExtensionContentProvider<S>
impl<S> ExtensionContentProvider<S>
Sourcepub fn default_extension(self, extension: impl ToString) -> Self
pub fn default_extension(self, extension: impl ToString) -> Self
Sets the extension to assume for paths that carry none.
Sourcepub fn extension(
self,
extension: &str,
content_provider: impl ScriptContentProvider<S> + 'static,
) -> Self
pub fn extension( self, extension: &str, content_provider: impl ScriptContentProvider<S> + 'static, ) -> Self
Routes one extension to a provider.
Trait Implementations§
Source§impl<S> Default for ExtensionContentProvider<S>
impl<S> Default for ExtensionContentProvider<S>
Source§impl<S> ScriptContentProvider<S> for ExtensionContentProvider<S>
impl<S> ScriptContentProvider<S> for ExtensionContentProvider<S>
Source§fn load(&mut self, _: &str) -> Result<Option<S>, Box<dyn Error>>
fn load(&mut self, _: &str) -> Result<Option<S>, Box<dyn Error>>
Loads and parses one unit, or returns
None when there is nothing to
load.Source§fn unpack_load(
&mut self,
path: &str,
) -> Result<Vec<ScriptContent<S>>, Box<dyn Error>>
fn unpack_load( &mut self, path: &str, ) -> Result<Vec<ScriptContent<S>>, Box<dyn Error>>
Loads a path that may hold several units, such as an archive. Read more
Auto Trait Implementations§
impl<S> !RefUnwindSafe for ExtensionContentProvider<S>
impl<S> !Send for ExtensionContentProvider<S>
impl<S> !Sync for ExtensionContentProvider<S>
impl<S> !UnwindSafe for ExtensionContentProvider<S>
impl<S> Freeze for ExtensionContentProvider<S>
impl<S> Unpin for ExtensionContentProvider<S>
impl<S> UnsafeUnpin for ExtensionContentProvider<S>
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
Source§impl<T> Initialize for Twhere
T: Default,
impl<T> Initialize for Twhere
T: Default,
Source§fn initialize() -> T
fn initialize() -> T
Returns the initial value of this type.