Trait s2n_quic_transport::connection::Lock

source ·
pub trait Lock<T>: 'static + Send + Sync {
    type Error;

    // Required methods
    fn new(value: T) -> Self;
    fn read<F: FnOnce(&T) -> R, R>(&self, f: F) -> Result<R, Self::Error>;
    fn write<F: FnOnce(&mut T) -> R, R>(&self, f: F) -> Result<R, Self::Error>;
}
Expand description

A lock that synchronizes connection state between the QUIC endpoint thread and application

Required Associated Types§

Required Methods§

source

fn new(value: T) -> Self

Creates a connection lock

source

fn read<F: FnOnce(&T) -> R, R>(&self, f: F) -> Result<R, Self::Error>

Obtains a read-only reference to the inner connection

source

fn write<F: FnOnce(&mut T) -> R, R>(&self, f: F) -> Result<R, Self::Error>

Obtains a mutable reference to the inner connection

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T: 'static + Send> Lock<T> for Mutex<T>

§

type Error = ()

source§

fn new(value: T) -> Self

source§

fn read<F: FnOnce(&T) -> R, R>(&self, f: F) -> Result<R, Self::Error>

source§

fn write<F: FnOnce(&mut T) -> R, R>(&self, f: F) -> Result<R, Self::Error>

Implementors§