Trait DirectlyMutable

Source
pub trait DirectlyMutable:
    Directory
    + Send
    + Sync {
    // Required methods
    fn add_entry_impl(
        &self,
        name: Name,
        entry: Arc<dyn DirectoryEntry>,
        overwrite: bool,
    ) -> Result<(), AlreadyExists>;
    fn remove_entry_impl(
        &self,
        name: Name,
        must_be_directory: bool,
    ) -> Result<Option<Arc<dyn DirectoryEntry>>, NotDirectory>;

    // Provided methods
    fn add_entry<NameT>(
        &self,
        name: NameT,
        entry: Arc<dyn DirectoryEntry>,
    ) -> Result<(), Status>
       where NameT: Into<String>,
             Self: Sized { ... }
    fn add_entry_may_overwrite<NameT>(
        &self,
        name: NameT,
        entry: Arc<dyn DirectoryEntry>,
        overwrite: bool,
    ) -> Result<(), Status>
       where NameT: Into<String>,
             Self: Sized { ... }
    fn remove_entry<NameT>(
        &self,
        name: NameT,
        must_be_directory: bool,
    ) -> Result<Option<Arc<dyn DirectoryEntry>>, Status>
       where NameT: Into<String>,
             Self: Sized { ... }
}
Expand description

DirectlyMutable is a superset of MutableDirectory which also allows server-side management of directory entries (via add_entry and remove_entry).

Required Methods§

Source

fn add_entry_impl( &self, name: Name, entry: Arc<dyn DirectoryEntry>, overwrite: bool, ) -> Result<(), AlreadyExists>

Adds a child entry to this directory.

Source

fn remove_entry_impl( &self, name: Name, must_be_directory: bool, ) -> Result<Option<Arc<dyn DirectoryEntry>>, NotDirectory>

Removes a child entry from this directory. In case an entry with the matching name was found, the entry will be returned to the caller.

Provided Methods§

Source

fn add_entry<NameT>( &self, name: NameT, entry: Arc<dyn DirectoryEntry>, ) -> Result<(), Status>
where NameT: Into<String>, Self: Sized,

Adds a child entry to this directory.

Possible errors are:

  • ZX_ERR_INVALID_ARGS or ZX_ERR_BAD_PATH if name is not a valid Name.
  • ZX_ERR_ALREADY_EXISTS if an entry with the same name is already present in the directory.
Source

fn add_entry_may_overwrite<NameT>( &self, name: NameT, entry: Arc<dyn DirectoryEntry>, overwrite: bool, ) -> Result<(), Status>
where NameT: Into<String>, Self: Sized,

Adds a child entry to this directory. If overwrite is true, this function may overwrite an existing entry.

Possible errors are:

  • ZX_ERR_INVALID_ARGS or ZX_ERR_BAD_PATH if name is not a valid Name.
  • ZX_ERR_ALREADY_EXISTS if an entry with the same name is already present in the directory and overwrite is false.
Source

fn remove_entry<NameT>( &self, name: NameT, must_be_directory: bool, ) -> Result<Option<Arc<dyn DirectoryEntry>>, Status>
where NameT: Into<String>, Self: Sized,

Removes a child entry from this directory. In case an entry with the matching name was found, the entry will be returned to the caller. If must_be_directory is true, an error is returned if the entry is not a directory.

Possible errors are:

  • ZX_ERR_INVALID_ARGS or ZX_ERR_BAD_PATH if name is not a valid Name.
  • ZX_ERR_NOT_DIR if the entry identified by name is not a directory and must_be_directory is true.

Implementors§