A set of assets.
This is one of the two main entry points of this library. You create an
instance of this type via
Assets::new and then retrieve asset data via
Assets::get. The macro
assets! is the other main entry
point of this library. It generates a
Setup value at compile time which
you have to pass to
Creates a new instance of this type and, in prod mode, prepares all assets.
Returns the file contents of the asset referred to by
The given path is the "public" path, as it is a part of the actual
request URI. This doesn't mean this parameter has to be the full path
component from the request URI; you likely want to serve your assets in
a subdirectory, like
/assets/ which you would have to remove from the
URI-path before calling this method. However, for assets with hashed
filenames, this method expects the hashed path and not the one you
If no asset with the specified path exists,
Ok(None) is returned. An
error is returned in debug mode for a variety of reasons. In prod mode,
this method always returns
Resolves the public path to an asset ID. If the public path does not
match any asset,
None is returned.
Returns an iterator over the IDs of all assets.
pub fn asset_info(&self, id: AssetId) -> Info<'_>[src]
Returns meta information about a specific asset. Panics if no asset with the given ID exists.
impl RefUnwindSafe for Assets[src]
impl UnwindSafe for Assets[src]
type Output = T
Should always be
type Error = Infallible
The type returned in the event of a conversion error.