pub struct ConstrainedHandle { /* private fields */ }Expand description
Handle for sending data through the constrained transport
Implementations§
Source§impl ConstrainedHandle
impl ConstrainedHandle
Sourcepub fn connect(
&self,
remote: &TransportAddr,
) -> Result<ConnectionId, ConstrainedError>
pub fn connect( &self, remote: &TransportAddr, ) -> Result<ConnectionId, ConstrainedError>
Initiate a connection to a remote address
Sourcepub fn send(
&self,
connection_id: ConnectionId,
data: &[u8],
) -> Result<(), ConstrainedError>
pub fn send( &self, connection_id: ConnectionId, data: &[u8], ) -> Result<(), ConstrainedError>
Send data on an established connection
Sourcepub fn recv(
&self,
connection_id: ConnectionId,
) -> Result<Option<Vec<u8>>, ConstrainedError>
pub fn recv( &self, connection_id: ConnectionId, ) -> Result<Option<Vec<u8>>, ConstrainedError>
Receive data from a connection
Sourcepub fn close(&self, connection_id: ConnectionId) -> Result<(), ConstrainedError>
pub fn close(&self, connection_id: ConnectionId) -> Result<(), ConstrainedError>
Close a connection
Sourcepub fn connection_count(&self) -> usize
pub fn connection_count(&self) -> usize
Get the number of active connections
Sourcepub fn process_incoming(
&self,
source: &TransportAddr,
data: &[u8],
) -> Result<(), ConstrainedError>
pub fn process_incoming( &self, source: &TransportAddr, data: &[u8], ) -> Result<(), ConstrainedError>
Process an incoming packet
Sourcepub fn poll(&self) -> Vec<EngineOutput>
pub fn poll(&self) -> Vec<EngineOutput>
Poll for timeouts and get any pending outputs
Sourcepub fn next_event(&self) -> Option<AdapterEvent>
pub fn next_event(&self) -> Option<AdapterEvent>
Get the next event from the engine
Sourcepub fn connection_state(
&self,
connection_id: ConnectionId,
) -> Option<ConnectionState>
pub fn connection_state( &self, connection_id: ConnectionId, ) -> Option<ConnectionState>
Get the state of a specific connection
Sourcepub fn active_connections(&self) -> Vec<ConnectionId>
pub fn active_connections(&self) -> Vec<ConnectionId>
Get all active connection IDs
Trait Implementations§
Source§impl Clone for ConstrainedHandle
impl Clone for ConstrainedHandle
Source§fn clone(&self) -> ConstrainedHandle
fn clone(&self) -> ConstrainedHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ConstrainedHandle
impl RefUnwindSafe for ConstrainedHandle
impl Send for ConstrainedHandle
impl Sync for ConstrainedHandle
impl Unpin for ConstrainedHandle
impl UnsafeUnpin for ConstrainedHandle
impl UnwindSafe for ConstrainedHandle
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