Skip to main content

FileSystems

Enum FileSystems 

Source
pub enum FileSystems {}
Expand description

Global filesystem registry facade.

FileSystems is an uninhabited namespace type. It cannot be instantiated and only exposes static methods backed by a process-wide registry.

Implementations§

Source§

impl FileSystems

Source

pub fn register<P>(provider: P) -> FsResult<()>
where P: ServiceProvider<FileSystemSpec> + 'static,

Registers a filesystem provider in the global registry.

§Parameters
  • provider: Filesystem provider to register.
§Errors

Returns an error when a provider with the same descriptor already exists.

Source

pub fn register_shared(provider: Arc<FileSystemProvider>) -> FsResult<()>

Registers a shared filesystem provider in the global registry.

§Parameters
  • provider: Shared filesystem provider to register.
§Errors

Returns an error when a provider with the same descriptor already exists.

Source

pub fn fs(uri: &str) -> FsResult<Arc<dyn FileSystem>>

Resolves a URI into a filesystem instance from the global registry.

§Parameters
  • uri: Filesystem URI.
§Returns

A filesystem instance created by the matching provider.

§Errors

Returns an error when the URI cannot be parsed or no provider can create a filesystem for the URI scheme.

Source

pub fn fs_for_uri(uri: &FsUri) -> FsResult<Arc<dyn FileSystem>>

Resolves a parsed URI into a filesystem instance from the global registry.

§Parameters
  • uri: Parsed filesystem URI.
§Returns

A filesystem instance created by the matching provider.

§Errors

Returns an error when no provider can create a filesystem for the URI scheme.

Source

pub fn fs_for_scheme(scheme: &str) -> FsResult<Arc<dyn FileSystem>>

Resolves a filesystem instance from a URI scheme.

This is equivalent to resolving the minimal URI {scheme}:///. It is only suitable for providers that can be created from default authority, root path, and default options.

§Parameters
  • scheme: URI scheme used to select a provider.
§Returns

A filesystem instance created by the matching provider.

§Errors

Returns an error when the scheme cannot form a valid URI or no provider can create a filesystem from the minimal URI.

Source

pub fn resource(uri: &str) -> FsResult<FileResource>

Resolves a URI into a bound file resource from the global registry.

§Parameters
  • uri: Filesystem URI.
§Returns

A file resource containing the matching filesystem and filesystem-local path.

§Errors

Returns an error when the URI cannot be parsed or no provider can create a filesystem for the URI scheme.

Source

pub fn resource_for_uri(uri: &FsUri) -> FsResult<FileResource>

Resolves a parsed URI into a bound file resource from the global registry.

§Parameters
  • uri: Parsed filesystem URI.
§Returns

A file resource containing the matching filesystem and filesystem-local path.

§Errors

Returns an error when no provider can create a filesystem for the URI scheme.

Source

pub fn provider_names() -> Vec<String>

Lists provider names registered in the global registry.

§Returns

Registered provider names.

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> 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> IntoValueDefault<T> for T

Source§

fn into_value_default(self) -> T

Converts this argument into the default value.
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.