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§
Sourcefn add_entry_impl(
&self,
name: Name,
entry: Arc<dyn DirectoryEntry>,
overwrite: bool,
) -> Result<(), AlreadyExists>
fn add_entry_impl( &self, name: Name, entry: Arc<dyn DirectoryEntry>, overwrite: bool, ) -> Result<(), AlreadyExists>
Adds a child entry to this directory.
Sourcefn remove_entry_impl(
&self,
name: Name,
must_be_directory: bool,
) -> Result<Option<Arc<dyn DirectoryEntry>>, NotDirectory>
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§
Sourcefn add_entry<NameT>(
&self,
name: NameT,
entry: Arc<dyn DirectoryEntry>,
) -> Result<(), Status>
fn add_entry<NameT>( &self, name: NameT, entry: Arc<dyn DirectoryEntry>, ) -> Result<(), Status>
Adds a child entry to this directory.
Possible errors are:
ZX_ERR_INVALID_ARGS
orZX_ERR_BAD_PATH
ifname
is not a validName
.ZX_ERR_ALREADY_EXISTS
if an entry with the same name is already present in the directory.
Sourcefn add_entry_may_overwrite<NameT>(
&self,
name: NameT,
entry: Arc<dyn DirectoryEntry>,
overwrite: bool,
) -> Result<(), Status>
fn add_entry_may_overwrite<NameT>( &self, name: NameT, entry: Arc<dyn DirectoryEntry>, overwrite: bool, ) -> Result<(), Status>
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
orZX_ERR_BAD_PATH
ifname
is not a validName
.ZX_ERR_ALREADY_EXISTS
if an entry with the same name is already present in the directory andoverwrite
is false.
Sourcefn remove_entry<NameT>(
&self,
name: NameT,
must_be_directory: bool,
) -> Result<Option<Arc<dyn DirectoryEntry>>, Status>
fn remove_entry<NameT>( &self, name: NameT, must_be_directory: bool, ) -> Result<Option<Arc<dyn DirectoryEntry>>, Status>
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
orZX_ERR_BAD_PATH
ifname
is not a validName
.ZX_ERR_NOT_DIR
if the entry identified byname
is not a directory andmust_be_directory
is true.