pub struct LocalFileProvider;Expand description
Stateless synchronous provider for file: URIs on the host filesystem.
Paths are neither confined nor normalized before access. Methods inherit OS
permissions, follow symlinks except where explicitly documented, and may
block the calling thread; use LocalFileTreeSourceFactory with the runtime
worker for retained file-tree operations.
§Examples
use ailloli_ui_fs::FileProvider;
use ailloli_ui_fs_local::LocalFileProvider;
let provider = LocalFileProvider::new();
assert!(provider.capabilities().read);
assert!(provider.capabilities().watch);Implementations§
Source§impl LocalFileProvider
Constructs the stateless local provider.
impl LocalFileProvider
Constructs the stateless local provider.
Trait Implementations§
Source§impl Clone for LocalFileProvider
impl Clone for LocalFileProvider
Source§fn clone(&self) -> LocalFileProvider
fn clone(&self) -> LocalFileProvider
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LocalFileProvider
impl Debug for LocalFileProvider
Source§impl Default for LocalFileProvider
impl Default for LocalFileProvider
Source§fn default() -> LocalFileProvider
fn default() -> LocalFileProvider
Source§impl FileProvider for LocalFileProvider
Maps the generic provider contract to synchronous std::fs operations.
impl FileProvider for LocalFileProvider
Maps the generic provider contract to synchronous std::fs operations.
Source§fn capabilities(&self) -> FileCapabilities
fn capabilities(&self) -> FileCapabilities
Advertises read/write plus native watch support.
Source§fn read_dir(&self, uri: &FileUri) -> Result<Vec<FileEntry>, FileError>
fn read_dir(&self, uri: &FileUri) -> Result<Vec<FileEntry>, FileError>
Reads one directory level and sorts by name then URI path.
An empty directory returns an empty vector. Per-entry metadata failures abort the complete read rather than returning a partial list.
§Errors
Returns [FileError::InvalidUri] for a non-local URI or an entry path
that cannot become a local URI, and maps directory iteration or metadata
failures through [FileError::from_io].
Source§fn read_file(&self, uri: &FileUri) -> Result<Vec<u8>, FileError>
fn read_file(&self, uri: &FileUri) -> Result<Vec<u8>, FileError>
Reads the complete file into an owned byte vector.
§Errors
Returns [FileError::InvalidUri] for a non-local URI and maps the host
read failure through [FileError::from_io].
Source§fn write_file(&self, uri: &FileUri, bytes: &[u8]) -> Result<(), FileError>
fn write_file(&self, uri: &FileUri, bytes: &[u8]) -> Result<(), FileError>
Creates or truncates a file and writes bytes non-atomically.
Empty bytes create an empty file. Missing parents are not created.
§Errors
Returns [FileError::InvalidUri] for a non-local URI and maps create,
truncate, or write failures through [FileError::from_io].
Source§fn metadata(&self, uri: &FileUri) -> Result<FileMetadata, FileError>
fn metadata(&self, uri: &FileUri) -> Result<FileMetadata, FileError>
Returns symlink-aware metadata without following the link for kind.
§Errors
Returns [FileError::InvalidUri] for a non-local URI or a mapped host
metadata error when the entry itself cannot be inspected.
Source§fn canonical_uri(&self, uri: &FileUri) -> Result<Option<FileUri>, FileError>
fn canonical_uri(&self, uri: &FileUri) -> Result<Option<FileUri>, FileError>
Resolves the OS canonical path, returning None for any failure.
This deliberately collapses missing paths, permission failures, and other canonicalization errors to absence after URI validation succeeds.
§Errors
Returns [FileError::InvalidUri] when the source is not local or a
successful canonical host path cannot be represented as a local URI.
Source§fn create_dir(&self, uri: &FileUri) -> Result<(), FileError>
fn create_dir(&self, uri: &FileUri) -> Result<(), FileError>
Creates exactly one directory; parents are not created recursively.
§Errors
Returns [FileError::InvalidUri] for a non-local URI and maps the host
creation failure through [FileError::from_io].
Source§fn rename(&self, from: &FileUri, to: &FileUri) -> Result<(), FileError>
fn rename(&self, from: &FileUri, to: &FileUri) -> Result<(), FileError>
Delegates an OS rename/move without cross-filesystem fallback.
§Errors
Returns [FileError::InvalidUri] when either URI is non-local and maps
every host rename failure, including cross-device moves, through
[FileError::from_io].
Source§fn remove(&self, uri: &FileUri) -> Result<(), FileError>
fn remove(&self, uri: &FileUri) -> Result<(), FileError>
Removes one file, symlink, or empty directory non-recursively.
symlink_metadata ensures a link to a directory removes the link with
remove_file, never the target directory.
§Errors
Returns [FileError::InvalidUri] for a non-local URI and maps metadata,
file removal, or empty-directory removal failures through
[FileError::from_io].
§fn copy_entry(&self, from: &FileUri, to: &FileUri) -> Result<(), FileError>
fn copy_entry(&self, from: &FileUri, to: &FileUri) -> Result<(), FileError>
§fn move_entry(&self, from: &FileUri, to: &FileUri) -> Result<(), FileError>
fn move_entry(&self, from: &FileUri, to: &FileUri) -> Result<(), FileError>
Self::rename]. Read more