pub struct ConstrainedEngineAdapter { /* private fields */ }Expand description
Adapter that wraps ConstrainedEngine for transport integration
This provides a transport-agnostic interface for the constrained engine,
handling address translation between TransportAddr and SocketAddr.
Implementations§
Source§impl ConstrainedEngineAdapter
impl ConstrainedEngineAdapter
Sourcepub fn new(config: EngineConfig) -> Self
pub fn new(config: EngineConfig) -> Self
Create a new adapter with the given configuration
Sourcepub fn connect(
&mut self,
remote: &TransportAddr,
) -> Result<(ConnectionId, Vec<EngineOutput>), ConstrainedError>
pub fn connect( &mut self, remote: &TransportAddr, ) -> Result<(ConnectionId, Vec<EngineOutput>), ConstrainedError>
Initiate a connection to a remote address
Sourcepub fn process_incoming(
&mut self,
source: &TransportAddr,
data: &[u8],
) -> Result<Vec<EngineOutput>, ConstrainedError>
pub fn process_incoming( &mut self, source: &TransportAddr, data: &[u8], ) -> Result<Vec<EngineOutput>, ConstrainedError>
Process an incoming packet from a transport
Sourcepub fn send(
&mut self,
connection_id: ConnectionId,
data: &[u8],
) -> Result<Vec<EngineOutput>, ConstrainedError>
pub fn send( &mut self, connection_id: ConnectionId, data: &[u8], ) -> Result<Vec<EngineOutput>, ConstrainedError>
Send data on an established connection
Sourcepub fn recv(&mut self, connection_id: ConnectionId) -> Option<Vec<u8>>
pub fn recv(&mut self, connection_id: ConnectionId) -> Option<Vec<u8>>
Receive data from a connection (if available)
Sourcepub fn close(
&mut self,
connection_id: ConnectionId,
) -> Result<Vec<EngineOutput>, ConstrainedError>
pub fn close( &mut self, connection_id: ConnectionId, ) -> Result<Vec<EngineOutput>, ConstrainedError>
Close a connection
Sourcepub fn poll(&mut self) -> Vec<EngineOutput>
pub fn poll(&mut self) -> Vec<EngineOutput>
Poll for timeouts and retransmissions
Sourcepub fn next_event(&mut self) -> Option<AdapterEvent>
pub fn next_event(&mut self) -> Option<AdapterEvent>
Get the next event from the engine
Sourcepub fn connection_count(&self) -> usize
pub fn connection_count(&self) -> usize
Get the number of active connections
Sourcepub fn engine(&self) -> &ConstrainedEngine
pub fn engine(&self) -> &ConstrainedEngine
Get the underlying engine (for advanced use)
Sourcepub fn engine_mut(&mut self) -> &mut ConstrainedEngine
pub fn engine_mut(&mut self) -> &mut ConstrainedEngine
Get mutable access to the underlying 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§
Auto Trait Implementations§
impl Freeze for ConstrainedEngineAdapter
impl RefUnwindSafe for ConstrainedEngineAdapter
impl Send for ConstrainedEngineAdapter
impl Sync for ConstrainedEngineAdapter
impl Unpin for ConstrainedEngineAdapter
impl UnsafeUnpin for ConstrainedEngineAdapter
impl UnwindSafe for ConstrainedEngineAdapter
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