pub struct FsAssetResolver {
pub root: PathBuf,
/* private fields */
}Expand description
Resolver that loads files from a filesystem root. URIs are joined to
root as relative paths; absolute paths and file:// URIs are also
honored. Other schemes (http, https, …) error.
Fields§
§root: PathBufImplementations§
Trait Implementations§
Source§impl AssetResolver for FsAssetResolver
impl AssetResolver for FsAssetResolver
Source§fn fetch(&self, uri: &str) -> Result<Vec<u8>, AssetError>
fn fetch(&self, uri: &str) -> Result<Vec<u8>, AssetError>
Fetch the bytes referenced by
uri. The URI can be a relative or
absolute path, an http:// / https:// URL, an asset-service
reference, or anything else a caller-supplied resolver knows how to handle.Source§fn resolve_id(&self, id: &str) -> Option<String>
fn resolve_id(&self, id: &str) -> Option<String>
Resolve a bare asset
id (no path, no extension — e.g. an asset
service’s UUID) to a URI that fetch can load. A filesystem
resolver searches its root recursively for a file whose stem matches;
resolvers that can’t map an id return None (the default). Used as a
fallback for {% media id="…" /%} when the id isn’t a file sitting
directly in the asset root.Auto Trait Implementations§
impl !Freeze for FsAssetResolver
impl Forget for FsAssetResolver
impl Move for FsAssetResolver
impl RefUnwindSafe for FsAssetResolver
impl Send for FsAssetResolver
impl Sync for FsAssetResolver
impl Unpin for FsAssetResolver
impl UnsafeUnpin for FsAssetResolver
impl UnwindSafe for FsAssetResolver
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.