Expand description
Utility functions for fuchsia.io files.
Structs§
- Adapter
- Adapter to implement AsyncReadAt + AsyncGetSize for AsyncRead + AsyncSeek.
- Async
File - 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. - Async
Reader - 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. - Buffered
Async Read At - 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
. - Read
Named Error - An error encountered while reading a named file
- Write
Named Error - An error encountered while writing a named file
Enums§
- Read
Error - An error encountered while reading a file
- Write
Error - An error encountered while writing a file
Traits§
- Async
GetSize - Trait for getting the size of the file asynchronously.
- Async
GetSize Ext - An extension trait which adds utility methods to AsyncGetSize.
- Async
Read At - Trait for reading at a given offset asynchronously.
This is basically
futures::io::AsyncRead
with an extra offset. - Async
Read AtExt - An extension trait which adds utility methods to AsyncReadAt.
Functions§
- close
- Gracefully closes the file proxy from the remote end.
- 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_
in_ namespace - Opens the given
path
from the current namespace as a [FileProxy
]. - read
- Reads all data from the given file’s current offset to the end of the file.
- read_
fidl - 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
- read_
in_ namespace - Reads all data from the file at
path
in the current namespace. The path must be an absolute path. - read_
in_ namespace_ to_ fidl - 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 - read_
in_ namespace_ to_ string - Reads a utf-8 encoded string from the file at
path
in the current namespace. The path must be an absolute path. - read_
num_ bytes - Attempts to read a number of bytes from the given file’s current offset. This function may return less data than expected.
- read_
to_ string - Reads a utf-8 encoded string from the given file’s current offset to the end of the file.
- write
- Writes the given data into the given file.
- write_
fidl - Write the given FIDL message in a binary form into a file open for writing.
- write_
fidl_ in_ namespace - Write the given FIDL encoded message into a file at
path
. The path must be an absolute path. - write_
in_ namespace - Write the given data into a file at
path
in the current namespace. The path must be an absolute path.