Skip to main content

FileSystem

Trait FileSystem 

Source
pub trait FileSystem:
    ValueToString
    + Send
    + Sync
    + NonLocalValue
    + ValueDebug {
    // Required methods
    fn read(self: Vc<Self>, fs_path: FileSystemPath) -> Vc<FileContent>
       where Self: Sized;
    fn read_link(self: Vc<Self>, fs_path: FileSystemPath) -> Vc<LinkContent>
       where Self: Sized;
    fn raw_read_dir(
        self: Vc<Self>,
        fs_path: FileSystemPath,
    ) -> Vc<RawDirectoryContent>
       where Self: Sized;
    fn write(
        self: Vc<Self>,
        fs_path: FileSystemPath,
        content: Vc<FileContent>,
    ) -> Vc<()>
       where Self: Sized;
    fn write_link(
        self: Vc<Self>,
        fs_path: FileSystemPath,
        target: Vc<LinkContent>,
    ) -> Vc<()>
       where Self: Sized;
    fn metadata(self: Vc<Self>, fs_path: FileSystemPath) -> Vc<FileMeta>
       where Self: Sized;

    // Provided method
    fn root(self: Vc<Self>) -> Vc<FileSystemPath>
       where Self: Sized { ... }
}

Required Methods§

Source

fn read(self: Vc<Self>, fs_path: FileSystemPath) -> Vc<FileContent>
where Self: Sized,

Reads the target of a symbolic link (or of a junction point on Windows).

The base of the returned LinkContent::Link target depends on the link’s LinkType: root-relative and normalized for LinkType::ABSOLUTE links, or the raw link-relative on-disk value otherwise.

Returns LinkContent::Invalid if the target points outside of the filesystem root, and LinkContent::NotFound if fs_path doesn’t exist or isn’t a link.

Source

fn raw_read_dir( self: Vc<Self>, fs_path: FileSystemPath, ) -> Vc<RawDirectoryContent>
where Self: Sized,

Source

fn write( self: Vc<Self>, fs_path: FileSystemPath, content: Vc<FileContent>, ) -> Vc<()>
where Self: Sized,

Source

fn metadata(self: Vc<Self>, fs_path: FileSystemPath) -> Vc<FileMeta>
where Self: Sized,

Provided Methods§

Source

fn root(self: Vc<Self>) -> Vc<FileSystemPath>
where Self: Sized,

Returns the path to the root of the file system.

Trait Implementations§

Source§

impl Dynamic<Box<dyn FileSystem>> for Box<dyn FileSystem>

Source§

impl Dynamic<Box<dyn ValueDebug>> for Box<dyn FileSystem>

Available on debug-assertions enabled only.
Source§

impl Dynamic<Box<dyn ValueToString>> for Box<dyn FileSystem>

Source§

impl TraitVtablePrototype for Box<dyn FileSystem>

Source§

const LEN: usize = 7usize

Source§

const DEFAULTS: &[Option<&NativeFunction>]

Source§

impl Upcast<Box<dyn FileSystem>> for Box<dyn FileSystem>

Source§

impl Upcast<Box<dyn ValueDebug>> for Box<dyn FileSystem>

Available on debug-assertions enabled only.
Source§

impl Upcast<Box<dyn ValueToString>> for Box<dyn FileSystem>

Source§

impl UpcastStrict<Box<dyn ValueDebug>> for Box<dyn FileSystem>

Available on debug-assertions enabled only.
Source§

impl UpcastStrict<Box<dyn ValueToString>> for Box<dyn FileSystem>

Source§

impl VcValueTrait for Box<dyn FileSystem>

Source§

const IMPL_VTABLES: &'static VTableRegistry<Self::ValueTrait>

The per-trait vtable registry, populated by [crate::value_type::register_all_trait_methods] Read more
Source§

type ValueTrait = dyn FileSystem

Source§

fn get_trait_type_id() -> TraitTypeId

Returns the type id of the trait object.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl FileSystem for DiskFileSystem

Source§

impl FileSystem for EmbeddedFileSystem

Source§

impl FileSystem for NullFileSystem

Source§

impl FileSystem for VirtualFileSystem

Source§

impl<T> FileSystem for T
where T: Dynamic<Box<dyn FileSystem>> + ValueToString + Send + Sync + NonLocalValue + ValueDebug,