Skip to main content

SyncIo

Trait SyncIo 

Source
pub trait SyncIo:
    Send
    + Sync
    + Sized
    + 'static {
    type Directory: SyncIoDirectory;

Show 25 methods // Required methods fn attr_get( &self, query: NodeAttributesQuery, ) -> Result<(MutableNodeAttributes, ImmutableNodeAttributes), Status>; fn attr_set(&self, attributes: MutableNodeAttributes) -> Result<(), Status>; fn query_filesystem(&self) -> Result<FilesystemInfo, Status>; fn open<F: Factory<Self>>( &self, path: &str, flags: Flags, create_attributes: Option<MutableNodeAttributes>, query: NodeAttributesQuery, factory: F, ) -> Result<F::Result, Status>; fn open_pipelined<F: Factory<Self>>( &self, paths: &[&str], flags: Flags, query: NodeAttributesQuery, factory_fn: impl FnMut() -> F, ) -> impl Iterator<Item = Result<F::Result, Status>>; fn link_into(&self, target_dir: &Self, name: &str) -> Result<(), Status>; fn unlink(&self, name: &str, flags: UnlinkFlags) -> Result<(), Status>; fn rename( &self, old_path: &str, new_directory: &Self, new_path: &str, ) -> Result<(), Status>; fn create_symlink(&self, name: &str, target: &[u8]) -> Result<Self, Status>; fn read_partial( &self, offset: u64, max: usize, ) -> Result<(Vec<u8>, bool), Status>; fn write(&self, offset: u64, data: &[u8]) -> Result<usize, Status>; fn supports_vectored(&self) -> bool; unsafe fn readv( &self, offset: u64, iovecs: &mut [zx_iovec_t], ) -> Result<usize, Status>; fn writev( &self, offset: u64, iovecs: &[zx_iovec_t], ) -> Result<usize, Status>; fn truncate(&self, length: u64) -> Result<(), Status>; fn vmo_get(&self, flags: VmarFlags) -> Result<Vmo, Status>; fn sync(&self) -> Result<(), Status>; fn enable_verity( &self, descriptor: &zxio_fsverity_descriptor_t, ) -> Result<(), Status>; fn allocate( &self, offset: u64, len: u64, mode: AllocateMode, ) -> Result<(), Status>; fn xattr_get(&self, name: &[u8]) -> Result<Vec<u8>, Status>; fn xattr_set( &self, name: &[u8], value: &[u8], mode: XattrSetMode, ) -> Result<(), Status>; fn xattr_remove(&self, name: &[u8]) -> Result<(), Status>; fn xattr_list(&self) -> Result<Vec<Vec<u8>>, Status>; fn open_directory(&self) -> Result<Self::Directory, Status>; // Provided method fn read<E>( &self, offset: u64, len: usize, callback: impl FnMut(Vec<u8>) -> Result<usize, E>, map_err: impl FnOnce(Status) -> E, ) -> Result<usize, E> { ... }
}
Expand description

Trait abstraction for synchronous I/O operations on Fuchsia nodes.

Required Associated Types§

Required Methods§

Source

fn attr_get( &self, query: NodeAttributesQuery, ) -> Result<(MutableNodeAttributes, ImmutableNodeAttributes), Status>

Returns attributes in fuchsia.io’s FIDL representation.

Source

fn attr_set(&self, attributes: MutableNodeAttributes) -> Result<(), Status>

Sets attributes.

Source

fn query_filesystem(&self) -> Result<FilesystemInfo, Status>

Queries the filesystem info.

Source

fn open<F: Factory<Self>>( &self, path: &str, flags: Flags, create_attributes: Option<MutableNodeAttributes>, query: NodeAttributesQuery, factory: F, ) -> Result<F::Result, Status>

Opens a node relative to this directory.

Source

fn open_pipelined<F: Factory<Self>>( &self, paths: &[&str], flags: Flags, query: NodeAttributesQuery, factory_fn: impl FnMut() -> F, ) -> impl Iterator<Item = Result<F::Result, Status>>

Opens all nodes iteratively along the relative sub-paths given in paths. Each item in paths is opened from the node returned by opening the previous item in paths.

Links this node into target_dir with name.

Unlinks name from this directory.

Source

fn rename( &self, old_path: &str, new_directory: &Self, new_path: &str, ) -> Result<(), Status>

Renames old_path in this directory to new_path in new_directory.

Creates a symlink in this directory.

Source

fn read_partial( &self, offset: u64, max: usize, ) -> Result<(Vec<u8>, bool), Status>

Returns (data, eof), where eof is true if we encountered the end of the file. If eof is false, then it is still possible that a subsequent read would read no more i.e. the end of the file might have been reached. This might return fewer bytes than max.

Source

fn write(&self, offset: u64, data: &[u8]) -> Result<usize, Status>

Writes data at offset.

Source

fn supports_vectored(&self) -> bool

Returns true if vectored operations are supported.

Source

unsafe fn readv( &self, offset: u64, iovecs: &mut [zx_iovec_t], ) -> Result<usize, Status>

Reads into iovecs using a vectored read. This is only supported with a valid stream. See supports_vectored above.

§Safety

Same as zx::Stream::readv.

Source

fn writev(&self, offset: u64, iovecs: &[zx_iovec_t]) -> Result<usize, Status>

Writes from iovecs using vectored write. This is only supported with a valid stream. See supports_vectored above.

Source

fn truncate(&self, length: u64) -> Result<(), Status>

Truncates the file to length.

Source

fn vmo_get(&self, flags: VmarFlags) -> Result<Vmo, Status>

Returns a VMO backing the file.

Source

fn sync(&self) -> Result<(), Status>

Syncs this node.

Source

fn enable_verity( &self, descriptor: &zxio_fsverity_descriptor_t, ) -> Result<(), Status>

Enables fsverity on this file.

Source

fn allocate( &self, offset: u64, len: u64, mode: AllocateMode, ) -> Result<(), Status>

Allocates space for this file.

Source

fn xattr_get(&self, name: &[u8]) -> Result<Vec<u8>, Status>

Gets an extended attribute.

Source

fn xattr_set( &self, name: &[u8], value: &[u8], mode: XattrSetMode, ) -> Result<(), Status>

Sets an extended attribute.

Source

fn xattr_remove(&self, name: &[u8]) -> Result<(), Status>

Removes an extended attribute.

Source

fn xattr_list(&self) -> Result<Vec<Vec<u8>>, Status>

Lists extended attributes.

Source

fn open_directory(&self) -> Result<Self::Directory, Status>

Opens a directory iterator for this node.

Provided Methods§

Source

fn read<E>( &self, offset: u64, len: usize, callback: impl FnMut(Vec<u8>) -> Result<usize, E>, map_err: impl FnOnce(Status) -> E, ) -> Result<usize, E>

Attempts to read len bytes and will only return fewer if it encounters the end of the file, or an error. callback will be called for each chunk. If any bytes are successfully passed to callback, read will return the total number of bytes successfully written and any error encountered will be discarded.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§