pub trait FileSystemExt: Send + Sync {
// Provided methods
fn usage(&self) -> FsUsage { ... }
fn mkfifo<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 Path,
_mode: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn limits(&self) -> FsLimits { ... }
}Expand description
Optional filesystem extensions for resource tracking and special file types.
This trait provides methods that most custom filesystem implementations do not need to override. All methods have sensible defaults:
Built-in implementations (InMemoryFs, OverlayFs, MountableFs) override
these to provide real statistics. Custom backends can opt in by implementing
just the methods they need.
FileSystemExt is a supertrait of FileSystem, so its methods are
available on any dyn FileSystem trait object.
Provided Methods§
Sourcefn usage(&self) -> FsUsage
fn usage(&self) -> FsUsage
Get current filesystem usage statistics.
Returns total bytes used, file count, and directory count.
Used by du and df builtins.
§Default Implementation
Returns zeros. Implementations should override for accurate stats.
Sourcefn mkfifo<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 Path,
_mode: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mkfifo<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 Path,
_mode: u32,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a named pipe (FIFO) at the given path.
FIFOs are simulated as buffered files in the virtual filesystem. Reading from a FIFO returns its buffered content, writing appends to it.
§Default Implementation
Returns “not supported” error. Override in implementations that support FIFOs.