pub trait DeviceSession: Send + 'static {
// Required methods
fn read<'life0, 'life1, 'async_trait>(
&'life0 mut self,
stream: &'life1 mut ReadStream,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn receive(&mut self, frame: &[u8]) -> Result<(Vec<u8>, Option<Value>)>;
fn answer(
&mut self,
request: &Value,
action: Option<&Value>,
) -> Result<Vec<u8>>;
// Provided methods
fn greeting(&mut self) -> Result<Vec<u8>> { ... }
fn outgoing(&mut self) -> Option<Receiver<Vec<u8>>> { ... }
}Required Methods§
fn read<'life0, 'life1, 'async_trait>(
&'life0 mut self,
stream: &'life1 mut ReadStream,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn receive(&mut self, frame: &[u8]) -> Result<(Vec<u8>, Option<Value>)>
fn receive(&mut self, frame: &[u8]) -> Result<(Vec<u8>, Option<Value>)>
Automatic transport replies or a semantic request for the handler.
fn answer(&mut self, request: &Value, action: Option<&Value>) -> Result<Vec<u8>>
Provided Methods§
fn greeting(&mut self) -> Result<Vec<u8>>
fn outgoing(&mut self) -> Option<Receiver<Vec<u8>>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".