pub struct AssetLoaders { /* private fields */ }Expand description
Extension-keyed loader registry.
Self::default registers the built-in image and SVG loaders and
installs the image loader as the fallback, which is what makes a path with
an unrecognised extension attempt an image decode.
Implementations§
Source§impl AssetLoaders
impl AssetLoaders
Sourcepub fn empty() -> Self
pub fn empty() -> Self
A registry with no loaders and no fallback. Every load fails with
LoadErrorKind::Unsupported until something is registered.
Sourcepub fn register(&mut self, loader: impl AssetLoader)
pub fn register(&mut self, loader: impl AssetLoader)
Registers loader for each extension it names.
Sourcepub fn register_arc(&mut self, loader: Arc<dyn AssetLoader>)
pub fn register_arc(&mut self, loader: Arc<dyn AssetLoader>)
Registers an already shared loader. Useful when the same instance should also serve as the fallback.
Sourcepub fn set_fallback(&mut self, loader: Option<Arc<dyn AssetLoader>>)
pub fn set_fallback(&mut self, loader: Option<Arc<dyn AssetLoader>>)
Sets the loader used for paths whose extension nothing claims, or
clears it so those paths fail with LoadErrorKind::Unsupported.
Sourcepub fn fallback(&self) -> Option<&Arc<dyn AssetLoader>>
pub fn fallback(&self) -> Option<&Arc<dyn AssetLoader>>
The loader that handles unclaimed extensions, if any.
Sourcepub fn resolve(&self, path: &Path) -> Option<Arc<dyn AssetLoader>>
pub fn resolve(&self, path: &Path) -> Option<Arc<dyn AssetLoader>>
The loader that will handle path: the one registered for its
extension, else the fallback.
Sourcepub fn kind_for(&self, path: &Path) -> Option<AssetKind>
pub fn kind_for(&self, path: &Path) -> Option<AssetKind>
The family path will load as, if any loader handles it.
Sourcepub fn extensions(&self) -> impl Iterator<Item = &str>
pub fn extensions(&self) -> impl Iterator<Item = &str>
Every claimed extension, unordered.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AssetLoaders
impl !RefUnwindSafe for AssetLoaders
impl Send for AssetLoaders
impl Sync for AssetLoaders
impl Unpin for AssetLoaders
impl UnsafeUnpin for AssetLoaders
impl !UnwindSafe for AssetLoaders
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
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().