pub struct DeviceProxy { /* private fields */ }
Implementations§
Source§impl DeviceProxy
impl DeviceProxy
Sourcepub fn take_event_stream(&self) -> DeviceEventStream
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.
pub fn clone2(&self, request: ServerEnd<CloneableMarker>) -> Result<(), Error>
Sourcepub fn close(
&self,
) -> QueryResponseFut<CloseableCloseResult, DefaultFuchsiaResourceDialect>
pub fn close( &self, ) -> QueryResponseFut<CloseableCloseResult, DefaultFuchsiaResourceDialect>
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) -> QueryResponseFut<Vec<u8>, DefaultFuchsiaResourceDialect>
Sourcepub fn read(
&self,
count: u64,
) -> QueryResponseFut<ReadableReadResult, DefaultFuchsiaResourceDialect>
pub fn read( &self, count: u64, ) -> QueryResponseFut<ReadableReadResult, DefaultFuchsiaResourceDialect>
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 thancount
. - If
data.length
is less thancount
, it means that the seek offset has reached the end of file as part of this operation. - If
data.length
is zero whilecount
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 emptydata
vector.
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],
) -> QueryResponseFut<WritableWriteResult, DefaultFuchsiaResourceDialect>
pub fn write( &self, data: &[u8], ) -> QueryResponseFut<WritableWriteResult, DefaultFuchsiaResourceDialect>
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 thandata.length
. - If the server is unable to write all the data due to e.g. not enough
space,
actual_count
may be less thandata.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.
pub fn describe( &self, ) -> QueryResponseFut<DeviceDescribeResponse, DefaultFuchsiaResourceDialect>
Sourcepub fn open_client(
&self,
id: u32,
client: ServerEnd<DeviceMarker>,
) -> QueryResponseFut<i32, DefaultFuchsiaResourceDialect>
pub fn open_client( &self, id: u32, client: ServerEnd<DeviceMarker>, ) -> QueryResponseFut<i32, DefaultFuchsiaResourceDialect>
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,
) -> QueryResponseFut<(i32, u32), DefaultFuchsiaResourceDialect>
pub fn clr_set_feature( &self, clr: u32, set: u32, ) -> QueryResponseFut<(i32, u32), DefaultFuchsiaResourceDialect>
§allowed on Client PTYs
Clear and/or Set PTY Features
Sourcepub fn get_window_size(
&self,
) -> QueryResponseFut<(i32, WindowSize), DefaultFuchsiaResourceDialect>
pub fn get_window_size( &self, ) -> QueryResponseFut<(i32, WindowSize), DefaultFuchsiaResourceDialect>
Obtain the window size (in character cells)
Sourcepub fn make_active(
&self,
client_pty_id: u32,
) -> QueryResponseFut<i32, DefaultFuchsiaResourceDialect>
pub fn make_active( &self, client_pty_id: u32, ) -> QueryResponseFut<i32, DefaultFuchsiaResourceDialect>
§allowed on the Controlling PTY
Select which Client PTY receives input. Reads will simply block on non-active PTYs.
Sourcepub fn read_events(
&self,
) -> QueryResponseFut<(i32, u32), DefaultFuchsiaResourceDialect>
pub fn read_events( &self, ) -> QueryResponseFut<(i32, u32), DefaultFuchsiaResourceDialect>
Returns pending OOB events, simultaneously clearing them
Sourcepub fn set_window_size(
&self,
size: &WindowSize,
) -> QueryResponseFut<i32, DefaultFuchsiaResourceDialect>
pub fn set_window_size( &self, size: &WindowSize, ) -> QueryResponseFut<i32, DefaultFuchsiaResourceDialect>
§allowed on the Server PTY
Sets the window size
Trait Implementations§
Source§impl Clone for DeviceProxy
impl Clone for DeviceProxy
Source§fn clone(&self) -> DeviceProxy
fn clone(&self) -> DeviceProxy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DeviceProxy
impl Debug for DeviceProxy
Source§impl DeviceProxyInterface for DeviceProxy
impl DeviceProxyInterface for DeviceProxy
type CloseResponseFut = QueryResponseFut<Result<(), i32>>
type QueryResponseFut = QueryResponseFut<Vec<u8>>
type ReadResponseFut = QueryResponseFut<Result<Vec<u8>, i32>>
type WriteResponseFut = QueryResponseFut<Result<u64, i32>>
type DescribeResponseFut = QueryResponseFut<DeviceDescribeResponse>
type OpenClientResponseFut = QueryResponseFut<i32>
type ClrSetFeatureResponseFut = QueryResponseFut<(i32, u32)>
type GetWindowSizeResponseFut = QueryResponseFut<(i32, WindowSize)>
type MakeActiveResponseFut = QueryResponseFut<i32>
type ReadEventsResponseFut = QueryResponseFut<(i32, u32)>
type SetWindowSizeResponseFut = QueryResponseFut<i32>
fn clone2(&self, request: ServerEnd<CloneableMarker>) -> Result<(), Error>
fn close(&self) -> Self::CloseResponseFut
fn query(&self) -> Self::QueryResponseFut
fn read(&self, count: u64) -> Self::ReadResponseFut
fn write(&self, data: &[u8]) -> Self::WriteResponseFut
fn describe(&self) -> Self::DescribeResponseFut
fn open_client( &self, id: u32, client: ServerEnd<DeviceMarker>, ) -> Self::OpenClientResponseFut
fn clr_set_feature(&self, clr: u32, set: u32) -> Self::ClrSetFeatureResponseFut
fn get_window_size(&self) -> Self::GetWindowSizeResponseFut
fn make_active(&self, client_pty_id: u32) -> Self::MakeActiveResponseFut
fn read_events(&self) -> Self::ReadEventsResponseFut
fn set_window_size(&self, size: &WindowSize) -> Self::SetWindowSizeResponseFut
Source§impl Proxy for DeviceProxy
impl Proxy for DeviceProxy
Source§type Protocol = DeviceMarker
type Protocol = DeviceMarker
Proxy
controls.Source§fn from_channel(inner: AsyncChannel) -> Self
fn from_channel(inner: AsyncChannel) -> Self
Source§fn into_channel(self) -> Result<AsyncChannel, Self>
fn into_channel(self) -> Result<AsyncChannel, Self>
Source§fn as_channel(&self) -> &AsyncChannel
fn as_channel(&self) -> &AsyncChannel
§fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>
fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>
Auto Trait Implementations§
impl Freeze for DeviceProxy
impl !RefUnwindSafe for DeviceProxy
impl Send for DeviceProxy
impl Sync for DeviceProxy
impl Unpin for DeviceProxy
impl !UnwindSafe for DeviceProxy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)