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: Time) -> Result<DeviceEvent, Error>
pub fn wait_for_event(&self, deadline: Time) -> 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.
sourcepub fn write_frame(
&self,
frame: &Frame,
___deadline: Time
) -> Result<DeviceWriteFrameResult, Error>
pub fn write_frame( &self, frame: &Frame, ___deadline: Time ) -> Result<DeviceWriteFrameResult, Error>
Writes a frame to the device (data coming from network-end).
If the device was created with the
[fuchsia.net.tun/DeviceConfig.blocking
] option set to true
, calls to
WriteFrame
block until there is one buffer available to fulfill the
request.
- request
frame
inbound frame data and metadata.
- error
ZX_ERR_NOT_FOUND
if [Frame.port
] references an unknown port. - error
ZX_ERR_INVALID_ARGS
ifframe
is invalid. - error
ZX_ERR_BAD_STATE
if the device is offline. - error
ZX_ERR_BAD_STATE
if the device is offline. - error
ZX_ERR_NO_RESOURCES
if more than [fuchsia.net.tun/MAX_PENDING_OPERATIONS
] calls toWriteFrame
are pending. - error
ZX_ERR_SHOULD_WAIT
ifblocking
is set tofalse
and there are no buffers available to fulfill the request.
sourcepub fn read_frame(
&self,
___deadline: Time
) -> Result<DeviceReadFrameResult, Error>
pub fn read_frame( &self, ___deadline: Time ) -> Result<DeviceReadFrameResult, Error>
Gets the next frame from the device (data coming from host-end).
If the device was created with the
[fuchsia.net.tun/DeviceConfig.blocking
] option set to true
, calls to
ReadFrame
block until there is a frame available to be read.
- response
frame
outbound frame data and metadata.
- error
ZX_ERR_NO_RESOURCES
if more than [fuchsia.net.tun/MAX_PENDING_OPERATIONS
] calls toReadFrame
are pending. - error
ZX_ERR_SHOULD_WAIT
ifblocking
is set tofalse
and there are no frames to be read.
sourcepub fn get_signals(&self, ___deadline: Time) -> Result<EventPair, Error>
pub fn get_signals(&self, ___deadline: Time) -> Result<EventPair, Error>
Retrieves signals eventpair.
- response
signals
an eventpair that is signalled withSIGNAL_READABLE
andSIGNAL_WRITABLE
when read and write buffers are available, respectively.
sourcepub fn add_port(
&self,
config: &DevicePortConfig,
port: ServerEnd<PortMarker>
) -> Result<(), Error>
pub fn add_port( &self, config: &DevicePortConfig, port: ServerEnd<PortMarker> ) -> Result<(), Error>
Creates a new port on this device.
- request
config
new port configuration. - request
port
grants control over the port. Closed with an epitaph ifconfig
is not valid.
sourcepub fn get_device(&self, device: ServerEnd<DeviceMarker>) -> Result<(), Error>
pub fn get_device(&self, device: ServerEnd<DeviceMarker>) -> Result<(), Error>
Connects to the underlying device endpoint.
- request
device
device handle.
Trait Implementations§
source§impl Debug for DeviceSynchronousProxy
impl Debug for DeviceSynchronousProxy
source§impl SynchronousProxy for DeviceSynchronousProxy
impl SynchronousProxy for DeviceSynchronousProxy
§type Proxy = DeviceProxy
type Proxy = DeviceProxy
The async proxy for the same protocol.
§type Protocol = DeviceMarker
type Protocol = DeviceMarker
The protocol which this
Proxy
controls.source§fn from_channel(inner: Channel) -> Self
fn from_channel(inner: Channel) -> Self
Create a proxy over the given channel.
source§fn into_channel(self) -> Channel
fn into_channel(self) -> Channel
Convert the proxy back into a channel.
source§fn as_channel(&self) -> &Channel
fn as_channel(&self) -> &Channel
Get a reference to the proxy’s underlying channel. Read more
Auto Trait Implementations§
impl Freeze for DeviceSynchronousProxy
impl RefUnwindSafe for DeviceSynchronousProxy
impl Send for DeviceSynchronousProxy
impl Sync for DeviceSynchronousProxy
impl Unpin for DeviceSynchronousProxy
impl UnwindSafe for DeviceSynchronousProxy
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
Mutably borrows from an owned value. Read more