pub struct FileSystem<P: CheckedPermissions> { /* private fields */ }Expand description
Implementations§
Source§impl<P: CheckedPermissions> FileSystem<P>
impl<P: CheckedPermissions> FileSystem<P>
pub fn open_file( &self, path: impl Into<String>, location: Location, flags: OpenFlags, ) -> Result<File<P>, Error>
pub fn open_dir( &self, path: impl Into<String>, location: Location, ) -> Result<Dir<P>, Error>
pub fn create_dir( &self, path: impl Into<String>, location: Location, ) -> Result<Dir<P>, Error>
pub fn create_dir_async( &self, path: impl Into<String>, location: Location, ) -> Result<CreateDirMessage, Error>
pub fn ensure_parent_dir_exists( &self, path: &str, location: Location, ) -> Result<(), Error>
pub fn remove(
&self,
path: impl Into<String>,
location: Location,
) -> Result<(), Error>where
P: MessageAllowed<Remove>,
pub fn remove_async(
&self,
path: impl Into<String>,
location: Location,
) -> Result<Remove, Error>where
P: MessageAllowed<Remove>,
Sourcepub fn atomic_copy(
&self,
src: impl Into<String>,
dest_dir: impl Into<String>,
rename: Option<impl Into<String>>,
location: Location,
) -> Result<(), Error>where
P: MessageAllowed<AtomicCopy>,
pub fn atomic_copy(
&self,
src: impl Into<String>,
dest_dir: impl Into<String>,
rename: Option<impl Into<String>>,
location: Location,
) -> Result<(), Error>where
P: MessageAllowed<AtomicCopy>,
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.
pub fn metadata(
&self,
path: impl Into<String>,
location: Location,
) -> Result<Metadata, Error>where
P: MessageAllowed<GetMetadata>,
pub fn rename(
&self,
from: impl Into<String>,
to: impl Into<String>,
location: Location,
) -> Result<(), Error>where
P: MessageAllowed<Rename>,
pub fn rename_async(
&self,
from: impl Into<String>,
to: impl Into<String>,
location: Location,
) -> Result<Rename, Error>where
P: MessageAllowed<Rename>,
Sourcepub fn durable_file_write(
&self,
path: &str,
location: Location,
data: &[u8],
) -> Result<(), Error>where
P: DurableFilePermissions,
pub fn durable_file_write(
&self,
path: &str,
location: Location,
data: &[u8],
) -> Result<(), Error>where
P: DurableFilePermissions,
Replace the contents of path with data, so that a crash at any point during the
write leaves FileSystem::durable_file_read either the complete old contents or
the complete new ones.
<path>.tmp and <path>.new belong to this file and must not be used for anything
else. Parent directories must already exist.
Sourcepub fn durable_file_read(
&self,
path: &str,
location: Location,
) -> Result<Vec<u8>, Error>where
P: DurableFilePermissions,
pub fn durable_file_read(
&self,
path: &str,
location: Location,
) -> Result<Vec<u8>, Error>where
P: DurableFilePermissions,
Read a file written by FileSystem::durable_file_write.
§Errors
Error::FileNotFound if no generation of the file exists.
pub fn map_file(
&self,
location: Location,
path: impl Into<String>,
) -> Result<MemoryRange, Error>where
P: MapFilePermissions,
pub fn subscribe_filesystem_events<S>( &self, listener: &mut ServerContext<S>, location: Location, )
pub fn wait_for_filesystem(&self, location: Location)where
P: 'static + MessageAllowed<SubscribeFilesystemEvent>,
Trait Implementations§
Source§impl<P: Clone + CheckedPermissions> Clone for FileSystem<P>
impl<P: Clone + CheckedPermissions> Clone for FileSystem<P>
Source§fn clone(&self) -> FileSystem<P>
fn clone(&self) -> FileSystem<P>
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<P: Debug + CheckedPermissions> Debug for FileSystem<P>
impl<P: Debug + CheckedPermissions> Debug for FileSystem<P>
Source§impl<P: Default + CheckedPermissions> Default for FileSystem<P>
impl<P: Default + CheckedPermissions> Default for FileSystem<P>
Source§fn default() -> FileSystem<P>
fn default() -> FileSystem<P>
Returns the “default value” for a type. Read more
Source§impl<P> FsAdapter for FileSystem<P>where
P: CheckedPermissions + MessageAllowed<CloseFile> + MessageAllowed<CloseDir> + MessageAllowed<NextEntry> + MessageAllowed<ReadFile> + MessageAllowed<WriteFile> + MessageAllowed<Flush> + MessageAllowed<SeekFile>,
impl<P> FsAdapter for FileSystem<P>where
P: CheckedPermissions + MessageAllowed<CloseFile> + MessageAllowed<CloseDir> + MessageAllowed<NextEntry> + MessageAllowed<ReadFile> + MessageAllowed<WriteFile> + MessageAllowed<Flush> + MessageAllowed<SeekFile>,
type DirIter = DirIterator<P>
type File = File<P>
type Permissions = P
fn create_dir(&self, path: &str, location: Location) -> Result<(), Error>
fn remove(&self, path: &str, location: Location) -> Result<(), Error>where
P: MessageAllowed<Remove>,
fn atomic_copy(
&self,
src: &str,
dest: &str,
rename: Option<String>,
location: Location,
) -> Result<(), Error>where
P: MessageAllowed<AtomicCopy>,
fn open_file( &self, path: &str, location: Location, flags: OpenFlags, ) -> Result<Self::File, Error>
fn open_dir( &self, path: &str, location: Location, ) -> Result<Self::DirIter, Error>
fn metadata(&self, path: &str, location: Location) -> Result<Metadata, Error>
fn rename(&self, src: &str, dest: &str, location: Location) -> Result<(), Error>where
P: MessageAllowed<Rename>,
fn walk_dir(
&self,
path: &str,
location: Location,
) -> Result<DirWalker<Self>, Error>where
Self: Clone,
Self::Permissions: MessageAllowed<OpenDirMessage> + MessageAllowed<CloseDir> + MessageAllowed<NextEntry>,
fn ensure_parent_dir_exists( &self, path: &str, location: Location, ) -> Result<(), Error>
fn remove_if_exists(&self, path: &str, location: Location) -> Result<(), Error>
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> UnsafeUnpin for FileSystem<P>
impl<P> UnwindSafe for FileSystem<P>
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
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 N2where
T: SharedNiching<N1, N2>,
N1: Niching<T>,
N2: Niching<T>,
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2where
T: SharedNiching<N1, N2>,
N1: Niching<T>,
N2: Niching<T>,
§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
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>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.