Skip to main content

DeviceSession

Trait DeviceSession 

Source
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§

Source

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,

Source

fn receive(&mut self, frame: &[u8]) -> Result<(Vec<u8>, Option<Value>)>

Automatic transport replies or a semantic request for the handler.

Source

fn answer(&mut self, request: &Value, action: Option<&Value>) -> Result<Vec<u8>>

Provided Methods§

Source

fn greeting(&mut self) -> Result<Vec<u8>>

Source

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".

Implementors§

Source§

impl DeviceSession for netget::server::dc_peer::codec::Device

Source§

impl DeviceSession for netget::server::adc::codec::Device

Source§

impl DeviceSession for netget::server::adc_peer::codec::Device

Source§

impl DeviceSession for netget::server::soulseek::codec::Device

Source§

impl DeviceSession for netget::server::soulseek_peer::codec::Device

Source§

impl DeviceSession for netget::server::gnutella::codec::Device