Module fuchsia_fs::directory
source · Expand description
Utility functions for fuchsia.io directories.
Structs§
- A directory entry.
- Describes the type of event that occurred in the directory being watched.
- A message containing a
WatchEvent
and the filename (relative to the directory being watched) that triggered the event. - Provides a Stream of WatchMessages corresponding to filesystem events for a given directory. After receiving an error, the stream will return the error, and then will terminate. After it’s terminated, the stream is fused and will continue to return None when polled.
Enums§
- An error encountered while decoding a single directory entry.
- Error returned by readdir.
- Error returned by readdir_recursive.
Functions§
- Opens a new connection to the given
directory
. The cloned connection has the same permissions. - Opens a new connection to the given
directory
usingrequest
. The cloned connection has the same permissions asdirectory
. - Gracefully closes the directory proxy from the remote end.
- Creates a directory named
path
within theparent
directory if it doesn’t exist. - Creates a directory named
path
(including all segments leading up to the terminal segment) within theparent
directory. Returns a connection to the terminal directory. - Create a randomly named file in the given directory with the given prefix, and return its path and
FileProxy
.prefix
may contain “/”. - Returns
true
if an entry with the specified name exists in the given directory. - Returns
true
if an entry with the specified name exists in the given directory. - Opens the given
path
from the givenparent
directory as a [P::Proxy
]. The target is not verified to be any particular type and may not implement the [P
] protocol. - Asynchronously opens the given [
path
] in the current namespace, serving the connection over [request
]. Once the channel is connected, any calls made prior are serviced. - Opens the given
path
from givenparent
directory as a [DirectoryProxy
], verifying that the target implements the fuchsia.io.Directory protocol. - Opens the given
path
from the givenparent
directory as a [DirectoryProxy
]. If open fails, the returnedDirectoryProxy
will be closed with an epitaph. - Opens the given
path
from givenparent
directory as a [FileProxy
], verifying that the target implements the fuchsia.io.File protocol. - Opens the given
path
from the givenparent
directory as a [FileProxy
]. If open fails, the returnedFileProxy
will be closed with an epitaph. - Opens the given
path
from the current namespace as a [DirectoryProxy
]. - Opens the given
path
from the givenparent
directory as a [NodeProxy
], verifying that the target implements the fuchsia.io.Node protocol. - Parses the buffer returned by a read_dirents FIDL call.
- Opens
path
from theparent
directory as a file and reads the file contents into a Vec. - Opens
path
from theparent
directory as a file and reads the file contents as a utf-8 encoded string. - Returns a sorted Vec of directory entries contained directly in the given directory proxy. The returned entries will not include “.” or nodes from any subdirectories.
- Returns a sorted Vec of directory entries contained directly in the given directory proxy. (Like
readdir
, but includes the dot path as well.) - Returns a Vec of all non-directory nodes and all empty directory nodes in the given directory proxy. The returned entries will not include “.”. |timeout| can be provided optionally to specify the maximum time to wait for a directory to be read.
- Returns Stream of nodes in tree rooted at the given DirectoryProxy for which |results_filter| returns
true
plus any leaf (empty) directories. The results filter receives the directory entry for the node in question and if the node is a directory, a reference a Vec of the directory’s contents. The function recurses into sub-directories for which |recurse_filter| returns true. The returned entries will not include “.”. |timeout| can be provided optionally to specify the maximum time to wait for a directory to be read. - Returns a sorted Vec of directory entries contained directly in the given directory proxy. The returned entries will not include “.” or nodes from any subdirectories. Timeouts if the read takes longer than the given
timeout
duration. - Removes a directory and all of its children.
name
must be a subdirectory ofroot_dir
. - Rename
src
todst
under the given directory,src
anddst
may contain “/”.