pub struct SessionProxy { /* private fields */ }
Implementations§
Source§impl SessionProxy
impl SessionProxy
Sourcepub fn new(channel: AsyncChannel) -> Self
pub fn new(channel: AsyncChannel) -> Self
Create a new Proxy for fuchsia.hardware.network/Session.
Sourcepub fn take_event_stream(&self) -> SessionEventStream
pub fn take_event_stream(&self) -> SessionEventStream
Get a Stream of events from the remote end of the protocol.
§Panics
Panics if the event stream was already taken.
Sourcepub fn attach(
&self,
port: &PortId,
rx_frames: &[FrameType],
) -> QueryResponseFut<SessionAttachResult, DefaultFuchsiaResourceDialect>
pub fn attach( &self, port: &PortId, rx_frames: &[FrameType], ) -> QueryResponseFut<SessionAttachResult, DefaultFuchsiaResourceDialect>
Attaches the session to port
.
Once attached, the session starts to receive the subscribed frames over
the data FIFOs and it may send frames destined to the specified port
.
- request
port
port to subscribe to. - request
rx_frames
Frame types of interest on the port.
- error
ZX_ERR_NOT_FOUND
ifport
is not valid. - error
ZX_ERR_INVALID_ARGS
ifrx_frames
is not a subset of the port’s supported frames. - error
ZX_ERR_ALREADY_BOUND
ifport
is already attached.
Sourcepub fn detach(
&self,
port: &PortId,
) -> QueryResponseFut<SessionDetachResult, DefaultFuchsiaResourceDialect>
pub fn detach( &self, port: &PortId, ) -> QueryResponseFut<SessionDetachResult, DefaultFuchsiaResourceDialect>
Detaches the session from port
.
Once detached, the session stops receiving frames from port
. Frames
sent to a detached port may be returned with an error. It is not
necessary to call Detach
on ports that are removed from the device,
doing so causes ZX_ERR_NOT_FOUND
to be returned.
- request
port
port to subscribe to.
- error
ZX_ERR_NOT_FOUND
if the session is not currently attached to the port.
Sourcepub fn close(&self) -> Result<(), Error>
pub fn close(&self) -> Result<(), Error>
Cleanly closes a session.
This will cause the session to send a ZX_ERR_CANCELLED
epitaph and
proceed to close the Session channel. Clients may only assume that they
own all the buffers that are currently owned by the session (sent over
either the rx or tx FIFOs) once the epitaph is received. Closing the rx
or tx FIFO is equivalent to calling Close
.
Sourcepub fn watch_delegated_rx_lease(
&self,
) -> QueryResponseFut<DelegatedRxLease, DefaultFuchsiaResourceDialect>
pub fn watch_delegated_rx_lease( &self, ) -> QueryResponseFut<DelegatedRxLease, DefaultFuchsiaResourceDialect>
Watchers for delegated receive wakeup leases.
Calls block until a lease is delegated by the device. If a call to
WatchDelegatedRxLease
is made while a previous call is blocking, the
session is closed with ZX_ERR_BAD_STATE
. Will never yield any values
for sessions created without [SessionFlags.RECEIVE_RX_POWER_LEASES
].
Given a single lease is assumed sufficient to keep the system awake, the
server only keeps a single lease in its buffer. If a new delegated lease
becomes available and the client hasn’t popped the previous one with a
call to WatchDelegatedRxLease
, the server drops the previously pending
lease.
See DelegatedRxLease
for how to handle delegated leases.
Trait Implementations§
Source§impl Clone for SessionProxy
impl Clone for SessionProxy
Source§fn clone(&self) -> SessionProxy
fn clone(&self) -> SessionProxy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SessionProxy
impl Debug for SessionProxy
Source§impl Proxy for SessionProxy
impl Proxy for SessionProxy
Source§type Protocol = SessionMarker
type Protocol = SessionMarker
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>
Source§impl SessionProxyInterface for SessionProxy
impl SessionProxyInterface for SessionProxy
type AttachResponseFut = QueryResponseFut<Result<(), i32>>
type DetachResponseFut = QueryResponseFut<Result<(), i32>>
type WatchDelegatedRxLeaseResponseFut = QueryResponseFut<DelegatedRxLease>
fn attach( &self, port: &PortId, rx_frames: &[FrameType], ) -> Self::AttachResponseFut
fn detach(&self, port: &PortId) -> Self::DetachResponseFut
fn close(&self) -> Result<(), Error>
fn watch_delegated_rx_lease(&self) -> Self::WatchDelegatedRxLeaseResponseFut
Auto Trait Implementations§
impl Freeze for SessionProxy
impl !RefUnwindSafe for SessionProxy
impl Send for SessionProxy
impl Sync for SessionProxy
impl Unpin for SessionProxy
impl !UnwindSafe for SessionProxy
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
)