pub struct DeviceProxy { /* private fields */ }

Implementations§

source§

impl DeviceProxy

source

pub fn new(channel: AsyncChannel) -> Self

Create a new Proxy for fuchsia.hardware.pty/Device.

source

pub fn take_event_stream(&self) -> DeviceEventStream

Get a Stream of events from the remote end of the protocol.

§Panics

Panics if the event stream was already taken.

source

pub fn clone2(&self, request: ServerEnd<CloneableMarker>) -> Result<(), Error>

source

pub fn close(&self) -> QueryResponseFut<CloseableCloseResult>

Terminates the connection.

After calling Close, the client must not send any other requests.

Servers, after sending the status response, should close the connection regardless of status and without sending an epitaph.

Closing the client end of the channel should be semantically equivalent to calling Close without knowing when the close has completed or its status.

source

pub fn query(&self) -> QueryResponseFut<Vec<u8>>

source

pub fn read(&self, count: u64) -> QueryResponseFut<ReadableReadResult>

Reads up to ‘count’ bytes at the seek offset. The seek offset is moved forward by the number of bytes read.

§Invariants
  • The returned data.length will never be greater than count.
  • If data.length is less than count, it means that the seek offset has reached the end of file as part of this operation.
  • If data.length is zero while count is not, it means that the seek offset is already at or beyond the end of file, and no data could be read.
  • If count is zero, the server should perform all the checks ensuring read access without actually read anything, and return an empty data vector.

This method requires the [Rights.READ_BYTES] right.

Returns ZX_ERR_OUT_OF_RANGE if count is greater than MAX_TRANSFER_SIZE.

source

pub fn write(&self, data: &[u8]) -> QueryResponseFut<WritableWriteResult>

Writes data at the seek offset. The seek offset is moved forward by the number of bytes written. If the file is in append mode, the seek offset is first set to the end of the file, followed by the write, in one atomic step.

The file size may grow if the seek offset plus data.length is beyond the current end of file.

  • request data the byte buffer to write to the file.
  • response actual_count the number of bytes written.
§Invariants
  • The returned actual_count will never be greater than data.length.
  • If the server is unable to write all the data due to e.g. not enough space, actual_count may be less than data.length. If no bytes could be written, an error is returned.
  • If data.length is zero, the server should perform all the checks ensuring write access without mutating the file and return a successful write of zero bytes. The seek offset is still updated if in append mode.

This method requires the [Rights.WRITE_BYTES] right.

source

pub fn describe(&self) -> QueryResponseFut<DeviceDescribeResponse>

source

pub fn open_client( &self, id: u32, client: ServerEnd<DeviceMarker> ) -> QueryResponseFut<i32>

Open a client PTY device with a unique id. client should be a handle to one endpoint of a channel that (on success) will become an open connection to the newly created device. On failure, the channel will be closed. Closing the channel will close the connection and release the device. If the provided id is 0, then the new client is a controlling client and has the capability to open additional clients. If the current device is not a controlling client, ZX_ERR_ACCESS_DENIED will be returned. If id is not unique, ZX_ERR_INVALID_ARGS will be returned. Otherwise the status code from device_add is passed on.

source

pub fn clr_set_feature( &self, clr: u32, set: u32 ) -> QueryResponseFut<(i32, u32)>

§allowed on Client PTYs

Clear and/or Set PTY Features

source

pub fn get_window_size(&self) -> QueryResponseFut<(i32, WindowSize)>

Obtain the window size (in character cells)

source

pub fn make_active(&self, client_pty_id: u32) -> QueryResponseFut<i32>

§allowed on the Controlling PTY

Select which Client PTY receives input. Reads will simply block on non-active PTYs.

source

pub fn read_events(&self) -> QueryResponseFut<(i32, u32)>

Returns pending OOB events, simultaneously clearing them

source

pub fn set_window_size(&self, size: &WindowSize) -> QueryResponseFut<i32>

§allowed on the Server PTY

Sets the window size

Trait Implementations§

source§

impl Clone for DeviceProxy

source§

fn clone(&self) -> DeviceProxy

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DeviceProxy

source§

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

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

impl DeviceProxyInterface for DeviceProxy

source§

fn clone2(&self, request: ServerEnd<CloneableMarker>) -> Result<(), Error>

§

type CloseResponseFut = QueryResponseFut<Result<(), i32>>

source§

fn close(&self) -> Self::CloseResponseFut

§

type QueryResponseFut = QueryResponseFut<Vec<u8>>

source§

fn query(&self) -> Self::QueryResponseFut

§

type ReadResponseFut = QueryResponseFut<Result<Vec<u8>, i32>>

source§

fn read(&self, count: u64) -> Self::ReadResponseFut

§

type WriteResponseFut = QueryResponseFut<Result<u64, i32>>

source§

fn write(&self, data: &[u8]) -> Self::WriteResponseFut

§

type DescribeResponseFut = QueryResponseFut<DeviceDescribeResponse>

source§

fn describe(&self) -> Self::DescribeResponseFut

§

type OpenClientResponseFut = QueryResponseFut<i32>

source§

fn open_client( &self, id: u32, client: ServerEnd<DeviceMarker> ) -> Self::OpenClientResponseFut

§

type ClrSetFeatureResponseFut = QueryResponseFut<(i32, u32)>

source§

fn clr_set_feature(&self, clr: u32, set: u32) -> Self::ClrSetFeatureResponseFut

§

type GetWindowSizeResponseFut = QueryResponseFut<(i32, WindowSize)>

source§

fn get_window_size(&self) -> Self::GetWindowSizeResponseFut

§

type MakeActiveResponseFut = QueryResponseFut<i32>

source§

fn make_active(&self, client_pty_id: u32) -> Self::MakeActiveResponseFut

§

type ReadEventsResponseFut = QueryResponseFut<(i32, u32)>

source§

fn read_events(&self) -> Self::ReadEventsResponseFut

§

type SetWindowSizeResponseFut = QueryResponseFut<i32>

source§

fn set_window_size(&self, size: &WindowSize) -> Self::SetWindowSizeResponseFut

source§

impl Proxy for DeviceProxy

§

type Protocol = DeviceMarker

The protocol which this Proxy controls.
source§

fn from_channel(inner: AsyncChannel) -> Self

Create a proxy over the given channel.
source§

fn into_channel(self) -> Result<AsyncChannel, Self>

Attempt to convert the proxy back into a channel. Read more
source§

fn as_channel(&self) -> &AsyncChannel

Get a reference to the proxy’s underlying channel. Read more
§

fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>

Attempt to convert the proxy back into a client end. Read more
§

fn is_closed(&self) -> bool

Returns true if the proxy has received the PEER_CLOSED signal.
§

fn on_closed(&self) -> OnSignals<'_, Unowned<'_, Handle>>

Returns a future that completes when the proxy receives the PEER_CLOSED signal.

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
§

impl<T> Encode<Ambiguous1> for T

§

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
§

impl<T> Encode<Ambiguous2> for T

§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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