pub struct RemoteIo { /* private fields */ }Expand description
Wraps a proxy and optional stream and provides wrappers around most fuchsia.io methods.
NOTE: The caller must take care to call appropriate methods for the underlying type. Calling the wrong methods (e.g. calling file methods on a directory) will result in the connection being closed.
Implementations§
Source§impl RemoteIo
impl RemoteIo
pub fn new(proxy: NodeSynchronousProxy) -> Self
pub fn with_stream(proxy: NodeSynchronousProxy, stream: Stream) -> Self
pub fn into_proxy(self) -> NodeSynchronousProxy
Sourcepub fn clone_proxy(&self) -> Result<NodeSynchronousProxy, Status>
pub fn clone_proxy(&self) -> Result<NodeSynchronousProxy, Status>
Clones (in the fuchsia.unknown.Clonable sense) the underlying proxy.
Sourcepub fn attr_get_zxio(
&self,
query: NodeAttributesQuery,
) -> Result<zxio_node_attributes_t, Status>
pub fn attr_get_zxio( &self, query: NodeAttributesQuery, ) -> Result<zxio_node_attributes_t, Status>
Returns attributes mapped to zxio_node_attributes_t.
NOTE: Not all attributes are supported. See zxio_attr_from_fidl above for supported
attributes.
Trait Implementations§
Source§impl SyncIo for RemoteIo
impl SyncIo for RemoteIo
Source§fn attr_get(
&self,
query: NodeAttributesQuery,
) -> Result<(MutableNodeAttributes, ImmutableNodeAttributes), Status>
fn attr_get( &self, query: NodeAttributesQuery, ) -> Result<(MutableNodeAttributes, ImmutableNodeAttributes), Status>
Returns attributes in fuchsia.io’s FIDL representation.
Source§fn open<F: Factory<Self>>(
&self,
path: &str,
flags: Flags,
create_attributes: Option<MutableNodeAttributes>,
query: NodeAttributesQuery,
factory: F,
) -> Result<F::Result, Status>
fn open<F: Factory<Self>>( &self, path: &str, flags: Flags, create_attributes: Option<MutableNodeAttributes>, query: NodeAttributesQuery, factory: F, ) -> Result<F::Result, Status>
Wraps fuchsia.io/Directory’s Open.
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>>
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.
factory_fn is used to create the factory argument to create_with_on_representation.
The return vector can be smaller than the initial paths vector, and execution will
always stop with the first error appending an Err(status) into the results.
NOTE: To prevent opening and writing through non-directory nodes, this function adds
fio::Flags::PROTOCOL_DIRECTORY | fio::Flags::PROTOCOL_SYMLINK to intermediate components.
Source§fn read_partial(
&self,
offset: u64,
max: usize,
) -> Result<(Vec<u8>, bool), Status>
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 supports_vectored(&self) -> bool
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>
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>
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 link_into(&self, target_dir: &Self, name: &str) -> Result<(), Status>
fn link_into(&self, target_dir: &Self, name: &str) -> Result<(), Status>
Wraps fuchsia.io/Node’s LinkInto.
Source§fn unlink(&self, name: &str, flags: UnlinkFlags) -> Result<(), Status>
fn unlink(&self, name: &str, flags: UnlinkFlags) -> Result<(), Status>
Wraps fuchsia.io/Directory’s Unlink.
Source§fn rename(
&self,
old_path: &str,
new_directory: &Self,
new_path: &str,
) -> Result<(), Status>
fn rename( &self, old_path: &str, new_directory: &Self, new_path: &str, ) -> Result<(), Status>
Wraps fuchsia.io/Directory’s Rename.
Source§fn create_symlink(&self, name: &str, target: &[u8]) -> Result<RemoteIo, Status>
fn create_symlink(&self, name: &str, target: &[u8]) -> Result<RemoteIo, Status>
Wraps fuchsia.io/Directory’s CreateSymlink.
Source§fn enable_verity(
&self,
descriptor: &zxio_fsverity_descriptor_t,
) -> Result<(), Status>
fn enable_verity( &self, descriptor: &zxio_fsverity_descriptor_t, ) -> Result<(), Status>
Wraps fuchsia.io/File’s EnableVerity.
Source§fn allocate(
&self,
offset: u64,
len: u64,
mode: AllocateMode,
) -> Result<(), Status>
fn allocate( &self, offset: u64, len: u64, mode: AllocateMode, ) -> Result<(), Status>
Wraps fuchsia.io/File’s Allocate.
Source§fn xattr_get(&self, name: &[u8]) -> Result<Vec<u8>, Status>
fn xattr_get(&self, name: &[u8]) -> Result<Vec<u8>, Status>
Wraps fuchsia.io/Node’s GetExtendedAttribute.
Source§fn xattr_set(
&self,
name: &[u8],
value: &[u8],
mode: XattrSetMode,
) -> Result<(), Status>
fn xattr_set( &self, name: &[u8], value: &[u8], mode: XattrSetMode, ) -> Result<(), Status>
Wraps fuchsia.io/Node’s SetExtendedAttribute.
Source§fn xattr_remove(&self, name: &[u8]) -> Result<(), Status>
fn xattr_remove(&self, name: &[u8]) -> Result<(), Status>
Wraps fuchsia.io/Node’s RenoveExtendedAttribute.
Source§fn xattr_list(&self) -> Result<Vec<Vec<u8>>, Status>
fn xattr_list(&self) -> Result<Vec<Vec<u8>>, Status>
Wraps fuchsia.io/Node’s ListExtendedAttributes.
type Directory = RemoteDirectory
Source§fn query_filesystem(&self) -> Result<FilesystemInfo, Status>
fn query_filesystem(&self) -> Result<FilesystemInfo, Status>
Source§fn open_directory(&self) -> Result<Self::Directory, Status>
fn open_directory(&self) -> Result<Self::Directory, Status>
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>
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>
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.