Struct syncio::Zxio

source ·
pub struct Zxio { /* private fields */ }
Expand description

A handle to a zxio object.

Note: the underlying storage backing the object is pinned on the heap because it can contain self referential data.

Implementations§

source§

impl Zxio

source

pub fn new_socket<S: ServiceConnector>( domain: c_int, socket_type: c_int, protocol: c_int ) -> Result<Result<Self, ZxioErrorCode>, Status>

source

pub fn create(handle: Handle) -> Result<Zxio, Status>

source

pub fn create_with_on_open(handle: Handle) -> Result<Zxio, Status>

source

pub fn release(self) -> Result<Handle, Status>

source

pub fn open(&self, flags: OpenFlags, path: &str) -> Result<Self, Status>

source

pub fn open2( &self, path: &str, options: OpenOptions, attributes: Option<&mut zxio_node_attributes_t> ) -> Result<Self, Status>

source

pub fn create_with_on_representation( handle: Handle, attributes: Option<&mut zxio_node_attributes_t> ) -> Result<Zxio, Status>

source

pub fn open_node( &self, path: &str, node_flags: NodeProtocolFlags, attributes: Option<&mut zxio_node_attributes_t> ) -> Result<Self, Status>

Opens a limited node connection (similar to O_PATH).

source

pub fn read(&self, data: &mut [u8]) -> Result<usize, Status>

source

pub unsafe fn readv(&self, data: &[zx_iovec]) -> Result<usize, Status>

Performs a vectorized read, returning the number of bytes read to data.

§Safety

The caller must check the returned Result to make sure the buffers provided are valid. The caller must provide pointers that are compatible with the backing implementation of zxio.

This call allows writing to arbitrary memory locations. It is up to the caller to make sure that calling this method does not result in undefined behaviour.

source

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

source

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

source

pub unsafe fn readv_at( &self, offset: u64, data: &[zx_iovec] ) -> Result<usize, Status>

Performs a vectorized read at an offset, returning the number of bytes read to data.

§Safety

The caller must check the returned Result to make sure the buffers provided are valid. The caller must provide pointers that are compatible with the backing implementation of zxio.

This call allows writing to arbitrary memory locations. It is up to the caller to make sure that calling this method does not result in undefined behaviour.

source

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

source

pub unsafe fn writev(&self, data: &[zx_iovec]) -> Result<usize, Status>

Performs a vectorized write, returning the number of bytes written from data.

§Safety

The caller must check the returned Result to make sure the buffers provided are valid. The caller must provide pointers that are compatible with the backing implementation of zxio.

This call allows reading from arbitrary memory locations. It is up to the caller to make sure that calling this method does not result in undefined behaviour.

source

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

source

pub unsafe fn writev_at( &self, offset: u64, data: &[zx_iovec] ) -> Result<usize, Status>

Performs a vectorized write at an offset, returning the number of bytes written from data.

§Safety

The caller must check the returned Result to make sure the buffers provided are valid. The caller must provide pointers that are compatible with the backing implementation of zxio.

This call allows reading from arbitrary memory locations. It is up to the caller to make sure that calling this method does not result in undefined behaviour.

source

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

source

pub fn seek( &self, seek_origin: SeekOrigin, offset: i64 ) -> Result<usize, Status>

source

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

source

pub fn attr_get( &self, query: zxio_node_attr_has_t ) -> Result<zxio_node_attributes_t, Status>

source

pub fn attr_get_with_root_hash( &self, query: zxio_node_attr_has_t, fsverity_root_hash: &mut [u8; 64] ) -> Result<zxio_node_attributes_t, Status>

Assumes that the caller has set query.fsverity_root_hash to true.

source

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

source

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

source

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

source

pub fn wait_begin( &self, zxio_signals: zxio_signals_t ) -> (Unowned<'_, Handle>, Signals)

source

pub fn wait_end(&self, signals: Signals) -> zxio_signals_t

source

pub fn create_dirent_iterator(&self) -> Result<DirentIterator<'_>, Status>

source

pub fn connect(&self, addr: &[u8]) -> Result<Result<(), ZxioErrorCode>, Status>

source

pub fn bind(&self, addr: &[u8]) -> Result<Result<(), ZxioErrorCode>, Status>

source

pub fn listen(&self, backlog: i32) -> Result<Result<(), ZxioErrorCode>, Status>

source

pub fn accept(&self) -> Result<Result<Zxio, ZxioErrorCode>, Status>

source

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

source

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

source

pub fn getsockopt( &self, level: u32, optname: u32, optlen: socklen_t ) -> Result<Result<Vec<u8>, ZxioErrorCode>, Status>

source

pub fn setsockopt( &self, level: i32, optname: i32, optval: &[u8] ) -> Result<Result<(), ZxioErrorCode>, Status>

source

pub fn shutdown( &self, flags: ZxioShutdownFlags ) -> Result<Result<(), ZxioErrorCode>, Status>

source

pub fn sendmsg( &self, addr: &mut [u8], buffer: &mut [iovec], cmsg: &[ControlMessage], flags: u32 ) -> Result<Result<usize, ZxioErrorCode>, Status>

source

pub fn recvmsg( &self, buffer: &mut [iovec], flags: u32 ) -> Result<Result<RecvMessageInfo, ZxioErrorCode>, Status>

source

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

source

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

source

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

source

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

source

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

Trait Implementations§

source§

impl Debug for Zxio

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Zxio

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Drop for Zxio

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for Zxio

§

impl RefUnwindSafe for Zxio

§

impl Send for Zxio

§

impl Sync for Zxio

§

impl Unpin for Zxio

§

impl UnwindSafe for Zxio

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> Encode<Ambiguous1> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _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> Encode<Ambiguous2> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

§

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>,

§

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more