Module file

Source
Expand description

Utility functions for fuchsia.io files.

Structs§

Adapter
Adapter to implement AsyncReadAt + AsyncGetSize for AsyncRead + AsyncSeek.
AsyncFile
Wraps a fidl_fuchsia_io::FileProxy and implements AsyncReadAt and AsyncGetSize, which allows one to perform asynchronous file reads that don’t block the current thread while waiting for data. Unlike AsyncReader, this struct does not require exclusive ownership, because read_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.
AsyncReader
Wraps a fidl_fuchsia_io::FileProxy and implements futures::io::AsyncRead, which allows one to perform asynchronous file reads that don’t block the current thread while waiting for data.
BufferedAsyncReadAt
Wraps an AsyncReadAt with an in-memory buffer of size fidl_fuchsia_io::MAX_TRANSFER_SIZE in which it stores the results of poll_read_at calls made to the wrapped AsyncReadAt.
ReadNamedError
An error encountered while reading a named file
WriteNamedError
An error encountered while writing a named file

Enums§

ReadError
An error encountered while reading a file
WriteError
An error encountered while writing a file

Traits§

AsyncGetSize
Trait for getting the size of the file asynchronously.
AsyncGetSizeExt
An extension trait which adds utility methods to AsyncGetSize.
AsyncReadAt
Trait for reading at a given offset asynchronously. This is basically futures::io::AsyncRead with an extra offset.
AsyncReadAtExt
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.