FileSystem

Struct FileSystem 

Source
pub struct FileSystem<P: CheckedPermissions> { /* private fields */ }
Expand description

Client handle for the filesystem server.

This is the filesystem crate’s high-level API surface. It owns a checked connection to os/fs, enforces location access checks, and creates File and Dir handles for file and directory operations.

Implementations§

Source§

impl<P: CheckedPermissions> FileSystem<P>

Source

pub fn open_file( &self, path: impl Into<String>, location: Location, flags: OpenFlags, ) -> Result<File<P>, Error>

  • Permission: os/fs / OpenFileMessage

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

Source

pub fn open_dir( &self, path: impl Into<String>, location: Location, ) -> Result<Dir<P>, Error>

  • Permission: os/fs / OpenDirMessage

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

Source

pub fn create_dir( &self, path: impl Into<String>, location: Location, ) -> Result<Dir<P>, Error>

  • Permission: os/fs / CreateDirMessage

    Groups: file-system.mutate-delete

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

Source

pub fn create_dir_async( &self, path: impl Into<String>, location: Location, ) -> Result<CreateDirMessage, Error>

  • Permission: os/fs / CreateDirMessage

    Groups: file-system.mutate-delete

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

Source

pub fn ensure_parent_dir_exists( &self, path: &str, location: Location, ) -> Result<(), Error>

  • Permission: os/fs / CreateDirMessage

    Groups: file-system.mutate-delete

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

Source

pub fn remove( &self, path: impl Into<String>, location: Location, ) -> Result<(), Error>

Permission: os/fs / Remove

Groups: file-system.mutate-delete

Sender policy: signed

Grant timing: location-grant

Source

pub fn remove_async( &self, path: impl Into<String>, location: Location, ) -> Result<Remove, Error>

Permission: os/fs / Remove

Groups: file-system.mutate-delete

Sender policy: signed

Grant timing: location-grant

Source

pub fn atomic_copy( &self, src: impl Into<String>, dest_dir: impl Into<String>, rename: Option<impl Into<String>>, location: Location, ) -> Result<(), Error>

Permission: os/fs / AtomicCopy

Groups: file-system.mutate-delete

Sender policy: signed

Grant timing: location-grant

Copy a source file/directory to a destination directory. If source is a directory, the copy is recursive.

Optionally, the copied file/directory can be renamed by providing the rename argument.

The destination directory must be empty; copying into a non-empty directory returns Error::FileAlreadyExists.

Source

pub fn metadata( &self, path: impl Into<String>, location: Location, ) -> Result<Metadata, Error>

Permission: os/fs / GetMetadata

Groups: file-system.file-handles

Sender policy: signed

Grant timing: location-grant

Source

pub fn rename( &self, from: impl Into<String>, to: impl Into<String>, location: Location, ) -> Result<(), Error>

Permission: os/fs / Rename

Groups: file-system.mutate-delete

Sender policy: signed

Grant timing: location-grant

Source

pub fn rename_async( &self, from: impl Into<String>, to: impl Into<String>, location: Location, ) -> Result<Rename, Error>

Permission: os/fs / Rename

Groups: file-system.mutate-delete

Sender policy: signed

Grant timing: location-grant

Source

pub fn map_file( &self, location: Location, path: impl Into<String>, ) -> Result<MemoryRange, Error>

Permission: none

Source

pub fn register_app_resources( &self, app_id: AppId, root: AppResourcesRoot, app_dir: impl Into<String>, ) -> Result<(), Error>

Permission: os/fs / RegisterAppResources

Groups: file-system.app-resource-registration

Sender policy: static-server

Grant timing: policy-only

Source

pub fn read_blocks( &mut self, location: Location, block_index: u32, block_count: usize, buf: MemoryRange, ) -> Result<usize, Error>

Permission: os/fs / ReadBlocks

Groups: file-system.raw-blocks

Sender policy: static-server

Grant timing: policy-only

Source

pub fn write_blocks( &mut self, location: Location, block_index: u32, block_count: usize, buf: MemoryRange, ) -> Result<usize, Error>

Permission: os/fs / WriteBlocks

Groups: file-system.raw-blocks

Sender policy: static-server

Grant timing: policy-only

Source

pub fn flush(&mut self, location: Location) -> Result<(), Error>

Permission: os/fs / FlushFs

Groups: file-system.file-handles

Sender policy: signed

Grant timing: location-grant

Source

pub fn block_count(&self, location: Location) -> Result<usize, Error>

Permission: os/fs / BlockCount

Groups: file-system.raw-blocks

Sender policy: static-server

Grant timing: policy-only

Source

pub fn format_encrypted_volume(&self)

Permission: os/fs / FormatEncryptedVolume

Groups: file-system.volume-admin

Sender policy: static-server

Grant timing: policy-only

Source

pub fn subscribe_filesystem_events<S>( &self, listener: &mut ServerContext<S>, location: Location, )

Permission: os/fs / SubscribeFilesystemEvent

Groups: file-system.file-handles

Sender policy: signed

Grant timing: location-grant

Source

pub fn wait_for_filesystem(&self, location: Location)

Permission: os/fs / SubscribeFilesystemEvent

Groups: file-system.file-handles

Sender policy: signed

Grant timing: location-grant

Source

pub fn mount_airlock(&mut self) -> Result<(), Error>

Permission: os/fs / MountAirlock

Groups: file-system.volume-admin

Sender policy: static-server

Grant timing: policy-only

Source

pub fn unmount_airlock(&mut self) -> Result<(), Error>

Permission: os/fs / MountAirlock

Groups: file-system.volume-admin

Sender policy: static-server

Grant timing: policy-only

Source

pub fn format_airlock(&mut self) -> Result<(), Error>

Permission: os/fs / FormatAirlock

Groups: file-system.volume-admin

Sender policy: static-server

Grant timing: policy-only

Trait Implementations§

Source§

impl<P: Clone + CheckedPermissions> Clone for FileSystem<P>

Source§

fn clone(&self) -> FileSystem<P>

Returns a duplicate 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<P: Debug + CheckedPermissions> Debug for FileSystem<P>

Source§

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

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

impl<P: Default + CheckedPermissions> Default for FileSystem<P>

Source§

fn default() -> FileSystem<P>

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

impl<P> FsAdapter for FileSystem<P>

Source§

type DirIter = DirIterator<P>

Source§

type File = File<P>

Source§

type Permissions = P

Source§

fn create_dir(&self, path: &str, location: Location) -> Result<(), Error>

  • Permission: os/fs / CloseFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / NextEntry

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / ReadFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / WriteFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Flush

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / SeekFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CreateDirMessage

    Groups: file-system.mutate-delete

    Sender policy: signed

    Grant timing: location-grant

Source§

fn remove(&self, path: &str, location: Location) -> Result<(), Error>

  • Permission: os/fs / CloseFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / NextEntry

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / ReadFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / WriteFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Flush

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / SeekFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Remove

    Groups: file-system.mutate-delete

    Sender policy: signed

    Grant timing: location-grant

Source§

fn atomic_copy( &self, src: &str, dest: &str, rename: Option<String>, location: Location, ) -> Result<(), Error>

  • Permission: os/fs / CloseFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / NextEntry

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / ReadFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / WriteFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Flush

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / SeekFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / AtomicCopy

    Groups: file-system.mutate-delete

    Sender policy: signed

    Grant timing: location-grant

Source§

fn open_file( &self, path: &str, location: Location, flags: OpenFlags, ) -> Result<Self::File, Error>

  • Permission: os/fs / CloseFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / NextEntry

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / ReadFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / WriteFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Flush

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / SeekFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / OpenFileMessage

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

Source§

fn open_dir( &self, path: &str, location: Location, ) -> Result<Self::DirIter, Error>

  • Permission: os/fs / CloseFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / NextEntry

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / ReadFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / WriteFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Flush

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / SeekFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / OpenDirMessage

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

Source§

fn metadata(&self, path: &str, location: Location) -> Result<Metadata, Error>

  • Permission: os/fs / CloseFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / NextEntry

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / ReadFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / WriteFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Flush

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / SeekFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / GetMetadata

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

Source§

fn rename(&self, src: &str, dest: &str, location: Location) -> Result<(), Error>

  • Permission: os/fs / CloseFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / NextEntry

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / ReadFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / WriteFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Flush

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / SeekFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Rename

    Groups: file-system.mutate-delete

    Sender policy: signed

    Grant timing: location-grant

Source§

fn flush(&mut self, location: Location) -> Result<(), Error>

  • Permission: os/fs / CloseFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / NextEntry

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / ReadFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / WriteFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Flush

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / SeekFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / FlushFs

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

Source§

fn walk_dir( &self, path: &str, location: Location, ) -> Result<DirWalker<Self>, Error>

  • Permission: os/fs / CloseFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / NextEntry

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / ReadFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / WriteFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Flush

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / SeekFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / OpenDirMessage

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

Source§

fn ensure_parent_dir_exists( &self, path: &str, location: Location, ) -> Result<(), Error>

  • Permission: os/fs / CloseFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / NextEntry

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / ReadFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / WriteFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Flush

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / SeekFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CreateDirMessage

    Groups: file-system.mutate-delete

    Sender policy: signed

    Grant timing: location-grant

Source§

fn remove_if_exists(&self, path: &str, location: Location) -> Result<(), Error>

  • Permission: os/fs / CloseFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / CloseDir

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / NextEntry

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / ReadFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / WriteFile

    Groups: file-system.read-write

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Flush

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / SeekFile

    Groups: file-system.file-handles

    Sender policy: signed

    Grant timing: location-grant

  • Permission: os/fs / Remove

    Groups: file-system.mutate-delete

    Sender policy: signed

    Grant timing: location-grant

Auto Trait Implementations§

§

impl<P> !Freeze for FileSystem<P>

§

impl<P> RefUnwindSafe for FileSystem<P>

§

impl<P> Send for FileSystem<P>

§

impl<P> Sync for FileSystem<P>

§

impl<P> Unpin for FileSystem<P>

§

impl<P> UnwindSafe for FileSystem<P>

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
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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.

§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
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.