Trait vfs::file::RawFileIoConnection
source · pub trait RawFileIoConnection: Send + Sync {
// Required methods
fn read(
&self,
count: u64,
) -> impl Future<Output = Result<Vec<u8>, Status>> + Send;
fn read_at(
&self,
offset: u64,
count: u64,
) -> impl Future<Output = Result<Vec<u8>, Status>> + Send;
fn write(
&self,
data: &[u8],
) -> impl Future<Output = Result<u64, Status>> + Send;
fn write_at(
&self,
offset: u64,
data: &[u8],
) -> impl Future<Output = Result<u64, Status>> + Send;
fn seek(
&self,
offset: i64,
origin: SeekOrigin,
) -> impl Future<Output = Result<u64, Status>> + Send;
fn update_flags(&self, flags: OpenFlags) -> Status;
}
Expand description
Trait for dispatching read, write, and seek FIDL requests for a given connection. The implementer of this trait is responsible for maintaining the per connection state.
Files that support Streams should handle reads and writes via a Pager instead of implementing this trait.
Required Methods§
sourcefn read(
&self,
count: u64,
) -> impl Future<Output = Result<Vec<u8>, Status>> + Send
fn read( &self, count: u64, ) -> impl Future<Output = Result<Vec<u8>, Status>> + Send
Reads at most count
bytes from the file starting at the connection’s seek offset and
advances the seek offset.
sourcefn read_at(
&self,
offset: u64,
count: u64,
) -> impl Future<Output = Result<Vec<u8>, Status>> + Send
fn read_at( &self, offset: u64, count: u64, ) -> impl Future<Output = Result<Vec<u8>, Status>> + Send
Reads count
bytes from the file starting at offset
.
sourcefn write(&self, data: &[u8]) -> impl Future<Output = Result<u64, Status>> + Send
fn write(&self, data: &[u8]) -> impl Future<Output = Result<u64, Status>> + Send
Writes data
to the file starting at the connect’s seek offset and advances the seek
offset. If the connection is in append mode then the seek offset is moved to the end of the
file before writing. Returns the number of bytes written.
sourcefn write_at(
&self,
offset: u64,
data: &[u8],
) -> impl Future<Output = Result<u64, Status>> + Send
fn write_at( &self, offset: u64, data: &[u8], ) -> impl Future<Output = Result<u64, Status>> + Send
Writes data
to the file starting at offset
. Returns the number of bytes written.
sourcefn seek(
&self,
offset: i64,
origin: SeekOrigin,
) -> impl Future<Output = Result<u64, Status>> + Send
fn seek( &self, offset: i64, origin: SeekOrigin, ) -> impl Future<Output = Result<u64, Status>> + Send
Modifies the connection’s seek offset. Returns the connections new seek offset.
sourcefn update_flags(&self, flags: OpenFlags) -> Status
fn update_flags(&self, flags: OpenFlags) -> Status
Notifies the IoOpHandler
that the flags of the connection have changed.