pub struct Files { /* private fields */ }Expand description
A wrapper that provides the Files API to templates
This struct is what gets injected into the template context as files.
It wraps any FileProvider implementation.
Implementations§
Source§impl Files
impl Files
Sourcepub fn new(provider: impl FileProvider + 'static) -> Self
pub fn new(provider: impl FileProvider + 'static) -> Self
Create a new Files wrapper from a provider
Sourcepub fn from_arc(provider: Arc<dyn FileProvider>) -> Self
pub fn from_arc(provider: Arc<dyn FileProvider>) -> Self
Create Files from an Arc’d provider (avoids double-Arc)
Sourcepub fn for_pack(pack_root: impl AsRef<Path>) -> Result<Self>
pub fn for_pack(pack_root: impl AsRef<Path>) -> Result<Self>
Create a sandboxed Files instance for a pack
Sourcepub fn mock() -> MockFileProvider
pub fn mock() -> MockFileProvider
Create a mock Files instance for testing
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Files
impl !RefUnwindSafe for Files
impl Send for Files
impl Sync for Files
impl Unpin for Files
impl !UnwindSafe for Files
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