Skip to main content

Module file

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.

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.
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_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.