Expand description
Utility functions for fuchsia.io directories.
Structs§
- DirEntry
- A directory entry.
- Watch
Event - Describes the type of event that occurred in the directory being watched.
- Watch
Message - A message containing a
WatchEvent
and the filename (relative to the directory being watched) that triggered the event. - Watcher
- 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§
- Decode
Dirent Error - An error encountered while decoding a single directory entry.
- Dirent
Kind - Enumerate
Error - Error returned by readdir.
- Recursive
Enumerate Error - Error returned by readdir_recursive.
- Watcher
Create Error - Watcher
Stream Error
Functions§
- clone
- Opens a new connection to the given
directory
. The cloned connection has the same permissions. - clone_
onto - Opens a new connection to the given
directory
usingrequest
. The cloned connection has the same permissions asdirectory
. - close
- Gracefully closes the directory proxy from the remote end.
- create_
directory - Creates a directory named
path
within theparent
directory if it doesn’t exist. - create_
directory_ recursive - 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_
randomly_ named_ file - Create a randomly named file in the given directory with the given prefix, and return its path
and
FileProxy
.prefix
may contain “/”. - dir_
contains - Returns
true
if an entry with the specified name exists in the given directory. - dir_
contains_ with_ timeout - Returns
true
if an entry with the specified name exists in the given directory. - open_
async - 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. - open_
channel_ in_ namespace - 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. - open_
directory - Opens the given
path
from givenparent
directory as a [DirectoryProxy
], verifying that the target implements the fuchsia.io.Directory protocol. - open_
directory_ async - Opens the given
path
from the givenparent
directory as a [DirectoryProxy
]. If open fails, the returnedDirectoryProxy
will be closed with an epitaph. - open_
file - Opens the given
path
from givenparent
directory as a [FileProxy
], verifying that the target implements the fuchsia.io.File protocol. - open_
file_ async - Opens the given
path
from the givenparent
directory as a [FileProxy
]. If open fails, the returnedFileProxy
will be closed with an epitaph. - open_
in_ namespace - Opens the given
path
from the current namespace as a [DirectoryProxy
]. - open_
node - Opens the given
path
from the givenparent
directory as a [NodeProxy
], verifying that the target implements the fuchsia.io.Node protocol. - parse_
dir_ entries - Parses the buffer returned by a read_dirents FIDL call.
- read_
file - Opens
path
from theparent
directory as a file and reads the file contents into a Vec. - read_
file_ to_ string - Opens
path
from theparent
directory as a file and reads the file contents as a utf-8 encoded string. - readdir
- 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.
- readdir_
inclusive - Returns a sorted Vec of directory entries contained directly in the given directory proxy.
(Like
readdir
, but includes the dot path as well.) - readdir_
recursive - 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.
- readdir_
recursive_ filtered - 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. - readdir_
with_ timeout - 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. - remove_
dir_ recursive - Removes a directory and all of its children.
name
must be a subdirectory ofroot_dir
. - rename
- Rename
src
todst
under the given directory,src
anddst
may contain “/”.