Struct LocalFileProvider

Source
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.

Source

pub fn new() -> Self

Returns a zero-sized provider with no filesystem access performed yet.

§Examples
use ailloli_ui_fs_local::LocalFileProvider;
let provider = LocalFileProvider::new();
assert_eq!(std::mem::size_of_val(&provider), 0);

Trait Implementations§

Source§

impl Clone for LocalFileProvider

Source§

fn clone(&self) -> LocalFileProvider

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LocalFileProvider

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LocalFileProvider

Source§

fn default() -> LocalFileProvider

Returns the “default value” for a type. Read more
Source§

impl FileProvider for LocalFileProvider

Maps the generic provider contract to synchronous std::fs operations.

Source§

fn capabilities(&self) -> FileCapabilities

Advertises read/write plus native watch support.

Source§

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>

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>

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>

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>

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>

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>

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>

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>

Recursively copies an entry using the provider’s primitive methods. Read more
§

fn move_entry(&self, from: &FileUri, to: &FileUri) -> Result<(), FileError>

Moves an entry; the default delegates directly to [Self::rename]. Read more
§

fn remove_recursive(&self, uri: &FileUri) -> Result<(), FileError>

Removes an entry subtree depth-first using primitive provider methods. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.