pub struct DeviceSynchronousProxy { /* private fields */ }Implementations§
Source§impl DeviceSynchronousProxy
impl DeviceSynchronousProxy
pub fn new(channel: Channel) -> Self
pub fn into_channel(self) -> Channel
Sourcepub fn wait_for_event(
&self,
deadline: MonotonicInstant,
) -> Result<DeviceEvent, Error>
pub fn wait_for_event( &self, deadline: MonotonicInstant, ) -> Result<DeviceEvent, Error>
Waits until an event arrives and returns it. It is safe for other threads to make concurrent requests while waiting for an event.
pub fn clone(&self, request: ServerEnd<CloneableMarker>) -> Result<(), Error>
Sourcepub fn close(
&self,
___deadline: MonotonicInstant,
) -> Result<CloseableCloseResult, Error>
pub fn close( &self, ___deadline: MonotonicInstant, ) -> Result<CloseableCloseResult, Error>
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.
pub fn query(&self, ___deadline: MonotonicInstant) -> Result<Vec<u8>, Error>
Sourcepub fn read(
&self,
count: u64,
___deadline: MonotonicInstant,
) -> Result<ReadableReadResult, Error>
pub fn read( &self, count: u64, ___deadline: MonotonicInstant, ) -> Result<ReadableReadResult, Error>
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.lengthwill never be greater thancount. - If
data.lengthis less thancount, it means that the seek offset has reached the end of file as part of this operation. - If
data.lengthis zero whilecountis not, it means that the seek offset is already at or beyond the end of file, and no data could be read. - If
countis zero, the server should perform all the checks ensuring read access without actually read anything, and return an emptydatavector.
This method requires the [Rights.READ_BYTES] right.
Returns ZX_ERR_OUT_OF_RANGE if count is greater than MAX_TRANSFER_SIZE.
Sourcepub fn write(
&self,
data: &[u8],
___deadline: MonotonicInstant,
) -> Result<WritableWriteResult, Error>
pub fn write( &self, data: &[u8], ___deadline: MonotonicInstant, ) -> Result<WritableWriteResult, Error>
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
datathe byte buffer to write to the file.
- response
actual_countthe number of bytes written.
§Invariants
- The returned
actual_countwill never be greater thandata.length. - If the server is unable to write all the data due to e.g. not enough
space,
actual_countmay be less thandata.length. If no bytes could be written, an error is returned. - If
data.lengthis 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.
pub fn describe( &self, ___deadline: MonotonicInstant, ) -> Result<DeviceDescribeResponse, Error>
Sourcepub fn open_client(
&self,
id: u32,
client: ServerEnd<DeviceMarker>,
___deadline: MonotonicInstant,
) -> Result<i32, Error>
pub fn open_client( &self, id: u32, client: ServerEnd<DeviceMarker>, ___deadline: MonotonicInstant, ) -> Result<i32, Error>
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.
Sourcepub fn clr_set_feature(
&self,
clr: u32,
set: u32,
___deadline: MonotonicInstant,
) -> Result<(i32, u32), Error>
pub fn clr_set_feature( &self, clr: u32, set: u32, ___deadline: MonotonicInstant, ) -> Result<(i32, u32), Error>
§allowed on Client PTYs
Clear and/or Set PTY Features
Sourcepub fn get_window_size(
&self,
___deadline: MonotonicInstant,
) -> Result<(i32, WindowSize), Error>
pub fn get_window_size( &self, ___deadline: MonotonicInstant, ) -> Result<(i32, WindowSize), Error>
Obtain the window size (in character cells)
Sourcepub fn make_active(
&self,
client_pty_id: u32,
___deadline: MonotonicInstant,
) -> Result<i32, Error>
pub fn make_active( &self, client_pty_id: u32, ___deadline: MonotonicInstant, ) -> Result<i32, Error>
§allowed on the Controlling PTY
Select which Client PTY receives input. Reads will simply block on non-active PTYs.
Sourcepub fn read_events(
&self,
___deadline: MonotonicInstant,
) -> Result<(i32, u32), Error>
pub fn read_events( &self, ___deadline: MonotonicInstant, ) -> Result<(i32, u32), Error>
Returns pending OOB events, simultaneously clearing them
Sourcepub fn set_window_size(
&self,
size: &WindowSize,
___deadline: MonotonicInstant,
) -> Result<i32, Error>
pub fn set_window_size( &self, size: &WindowSize, ___deadline: MonotonicInstant, ) -> Result<i32, Error>
§allowed on the Server PTY
Sets the window size
Trait Implementations§
Source§impl Debug for DeviceSynchronousProxy
impl Debug for DeviceSynchronousProxy
Source§impl From<Channel> for DeviceSynchronousProxy
Available on Fuchsia only.
impl From<Channel> for DeviceSynchronousProxy
Source§impl From<DeviceSynchronousProxy> for Handle
Available on Fuchsia only.
impl From<DeviceSynchronousProxy> for Handle
Source§fn from(value: DeviceSynchronousProxy) -> Self
fn from(value: DeviceSynchronousProxy) -> Self
Source§impl FromClient for DeviceSynchronousProxy
Available on Fuchsia only.
impl FromClient for DeviceSynchronousProxy
Source§type Protocol = DeviceMarker
type Protocol = DeviceMarker
Source§fn from_client(value: ClientEnd<DeviceMarker>) -> Self
fn from_client(value: ClientEnd<DeviceMarker>) -> Self
Source§impl SynchronousProxy for DeviceSynchronousProxy
Available on Fuchsia only.
impl SynchronousProxy for DeviceSynchronousProxy
Source§type Proxy = DeviceProxy
type Proxy = DeviceProxy
Source§type Protocol = DeviceMarker
type Protocol = DeviceMarker
Proxy controls.