Skip to main content

RemoteIo

Struct RemoteIo 

Source
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

Source

pub fn new(proxy: NodeSynchronousProxy) -> Self

Source

pub fn with_stream(proxy: NodeSynchronousProxy, stream: Stream) -> Self

Source

pub fn into_proxy(self) -> NodeSynchronousProxy

Source

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

Returns attributes in fuchsia.io’s FIDL representation.

Source

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.

Source

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

Sets attributes.

Source

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

Wraps fuchsia.io/Directory’s Open.

Source

pub 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

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

Source

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

Writes data at offset.

Source

pub fn supports_vectored(&self) -> bool

Returns true if vectored operations are supported.

Source

pub 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

pub 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

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

Wraps fuchsia.io/File’s Truncate.

Source

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

Returns a VMO backing the file.

Source

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

Wraps fuchsia.io/Node’s Sync.

Source

pub fn close_and_update_access_time(self)

Closes and updates access time asynchronously.

Source

pub fn clone_proxy(&self) -> Result<NodeSynchronousProxy, Status>

Clones (in the fuchsia.unknown.Clonable sense) the underlying proxy.

Wraps fuchsia.io/Node’s LinkInto.

Wraps fuchsia.io/Directory’s Unlink.

Source

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

Wraps fuchsia.io/Directory’s Rename.

Wraps fuchsia.io/Directory’s CreateSymlink.

Source

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

Wraps fuchsia.io/File’s EnableVerity.

Source

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

Wraps fuchsia.io/File’s Allocate.

Source

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

Wraps fuchsia.io/Node’s GetExtendedAttribute.

Source

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

Wraps fuchsia.io/Node’s SetExtendedAttribute.

Source

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

Wraps fuchsia.io/Node’s RenoveExtendedAttribute.

Source

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

Wraps fuchsia.io/Node’s ListExtendedAttributes.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.