QuicPoll

Trait QuicPoll 

Source
pub trait QuicPoll: Send + Sync {
    type Error;

    // Required methods
    fn poll(
        &self,
        events: &mut Vec<Event>,
    ) -> Result<Option<Instant>, Self::Error>;
    fn register(&self, wrapped: Connection) -> Result<Token, Self::Error>;
    fn deregister(&self, token: Token) -> Result<Connection, Self::Error>;
    fn len(&self) -> usize;
    fn close(
        &self,
        token: Token,
        app: bool,
        err: u64,
        reason: Cow<'static, [u8]>,
    ) -> Result<(), Self::Error>;
    fn stream_open(
        &self,
        token: Token,
        kind: StreamKind,
        non_blocking: bool,
    ) -> Result<Option<u64>, Self::Error>;
    fn stream_shutdown(
        &self,
        token: Token,
        stream_id: u64,
        err: u64,
    ) -> Result<(), Self::Error>;
    fn stream_send(
        &self,
        token: Token,
        stream_id: u64,
        buf: &[u8],
        fin: bool,
    ) -> Result<usize, Self::Error>;
    fn stream_recv(
        &self,
        token: Token,
        stream_id: u64,
        buf: &mut [u8],
    ) -> Result<(usize, bool), Self::Error>;
}
Expand description

A poll api for QUIC group.

Required Associated Types§

Required Methods§

Source

fn poll(&self, events: &mut Vec<Event>) -> Result<Option<Instant>, Self::Error>

Waits for readiness events without blocking current thread and returns possible retry time duration.

Source

fn register(&self, wrapped: Connection) -> Result<Token, Self::Error>

Wrap and handle a new quiche::Connection.

On success, returns a reference handle Token to the Connection.

Source

fn deregister(&self, token: Token) -> Result<Connection, Self::Error>

Unwrap a quiche::Connection referenced by the handle Token.

Source

fn len(&self) -> usize

Returns the number of QUIC connections in the group.

Source

fn close( &self, token: Token, app: bool, err: u64, reason: Cow<'static, [u8]>, ) -> Result<(), Self::Error>

Close a wrapped QUIC connection.

This function does not immediately remove the QUIC connection from memory, but instead waits until the QUIC connection has completed its closure process before actually removing it from memory.

See close for more information.

Source

fn stream_open( &self, token: Token, kind: StreamKind, non_blocking: bool, ) -> Result<Option<u64>, Self::Error>

Open a local stream via a QUIC connection.

Source

fn stream_shutdown( &self, token: Token, stream_id: u64, err: u64, ) -> Result<(), Self::Error>

Shuts down reading and writing from/to the specified stream.

See stream_send for more information.

Source

fn stream_send( &self, token: Token, stream_id: u64, buf: &[u8], fin: bool, ) -> Result<usize, Self::Error>

Writes data to a stream.

See stream_send for more information.

Source

fn stream_recv( &self, token: Token, stream_id: u64, buf: &mut [u8], ) -> Result<(usize, bool), Self::Error>

Reads contiguous data from a stream into the provided slice.

See stream_recv for more information.

Implementors§