Module fuchsia_fs::file
source · Expand description
Utility functions for fuchsia.io files.
Structs§
- Adapter to implement AsyncReadAt + AsyncGetSize for AsyncRead + AsyncSeek.
- Wraps a
fidl_fuchsia_io::FileProxy
and implementsAsyncReadAt
andAsyncGetSize
, which allows one to perform asynchronous file reads that don’t block the current thread while waiting for data. UnlikeAsyncReader
, this struct does not require exclusive ownership, becauseread_at
does not rely on the file offset state in the connection. This is useful if one wants to efficiently read different parts of the file at the same time. - Wraps a
fidl_fuchsia_io::FileProxy
and implementsfutures::io::AsyncRead
, which allows one to perform asynchronous file reads that don’t block the current thread while waiting for data. - Wraps an
AsyncReadAt
with an in-memory buffer of sizefidl_fuchsia_io::MAX_TRANSFER_SIZE
in which it stores the results ofpoll_read_at
calls made to the wrappedAsyncReadAt
. - An error encountered while reading a named file
- An error encountered while writing a named file
Enums§
- An error encountered while reading a file
- An error encountered while writing a file
Traits§
- Trait for getting the size of the file asynchronously.
- An extension trait which adds utility methods to AsyncGetSize.
- Trait for reading at a given offset asynchronously. This is basically
futures::io::AsyncRead
with an extra offset. - An extension trait which adds utility methods to AsyncReadAt.
Functions§
- Gracefully closes the file proxy from the remote end.
- 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 the current namespace as a [FileProxy
]. - Reads all data from the given file’s current offset to the end of the file.
- Read the given FIDL message from binary form from a file open for reading. FIDL structure should be provided at a read time. Incompatible data is populated as per FIDL ABI compatibility guide: https://fuchsia.dev/fuchsia-src/development/languages/fidl/guides/abi-compat
- Reads all data from the file at
path
in the current namespace. The path must be an absolute path. - Read the given FIDL message from binary file at
path
in the current namespace. The path must be an absolute path. FIDL structure should be provided at a read time. Incompatible data is populated as per FIDL ABI compatibility guide: https://fuchsia.dev/fuchsia-src/development/languages/fidl/guides/abi-compat - Reads a utf-8 encoded string from the file at
path
in the current namespace. The path must be an absolute path. - Attempts to read a number of bytes from the given file’s current offset. This function may return less data than expected.
- Reads a utf-8 encoded string from the given file’s current offset to the end of the file.
- Writes the given data into the given file.
- Write the given FIDL message in a binary form into a file open for writing.
- Write the given FIDL encoded message into a file at
path
. The path must be an absolute path. - Write the given data into a file at
path
in the current namespace. The path must be an absolute path.