dope-session 0.2.1

Thin io_uring adaptor with "Manifolds"
Documentation
use crate::CodecLayer;
use crate::SlotId;
use crate::session::Egress;
use dambi::Bytes;

pub trait ClientFramer: 'static {
    type Head;

    fn parse(&mut self, buf: &Bytes) -> Option<(Self::Head, usize)>;
}

pub trait ClientProtocol: 'static {
    type Framer: ClientFramer + Default + 'static;
    type ConnState: Default + 'static;
    type CodecLayer: CodecLayer;

    fn on_connect(
        &mut self,
        conn_id: SlotId,
        conn_state: &mut Self::ConnState,
        out: Egress<'_, Self::CodecLayer>,
    ) {
        let _ = (conn_id, conn_state, out);
    }

    fn on_response(
        &mut self,
        conn_id: SlotId,
        conn_state: &mut Self::ConnState,
        head: <Self::Framer as ClientFramer>::Head,
        out: Egress<'_, Self::CodecLayer>,
    );

    fn wants_close(&self, conn_state: &Self::ConnState) -> bool {
        let _ = conn_state;
        false
    }

    fn on_disconnect(
        &mut self,
        conn_id: SlotId,
        conn_state: &mut Self::ConnState,
        out: Egress<'_, Self::CodecLayer>,
    ) {
        let _ = (conn_id, conn_state, out);
    }
}