pub trait Connection:
Clone
+ Sized
+ Send
+ Sync
+ 'static {
// Required methods
fn connect<'async_trait>(
url: String,
) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'async_trait>>
where Self: 'async_trait;
fn read<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 mut Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<usize, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn write<'life0, 'life1, 'async_trait>(
&'life0 mut self,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn read_packet<'life0, 'async_trait, P>(
&'life0 mut self,
compressor: P,
) -> Pin<Box<dyn Future<Output = Result<Packet, Error>> + Send + 'async_trait>>
where P: 'async_trait + Compressor,
Self: 'async_trait,
'life0: 'async_trait { ... }
fn write_packet<'life0, 'async_trait, P>(
&'life0 mut self,
compressor: P,
packet: Packet,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where P: 'async_trait + Compressor,
Self: 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
A connection is an async interface to memcached, which requires a concrete implementation using an underlying async runtime (e.g. tokio or async-std.)
Required Methods§
Sourcefn connect<'async_trait>(
url: String,
) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
fn connect<'async_trait>(
url: String,
) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
Connect to a memcached server over TCP.
Provided Methods§
Sourcefn read_packet<'life0, 'async_trait, P>(
&'life0 mut self,
compressor: P,
) -> Pin<Box<dyn Future<Output = Result<Packet, Error>> + Send + 'async_trait>>where
P: 'async_trait + Compressor,
Self: 'async_trait,
'life0: 'async_trait,
fn read_packet<'life0, 'async_trait, P>(
&'life0 mut self,
compressor: P,
) -> Pin<Box<dyn Future<Output = Result<Packet, Error>> + Send + 'async_trait>>where
P: 'async_trait + Compressor,
Self: 'async_trait,
'life0: 'async_trait,
Read a packet response, possibly decompressing it. It is most likely unnecessary to implement this yourself.
Sourcefn write_packet<'life0, 'async_trait, P>(
&'life0 mut self,
compressor: P,
packet: Packet,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
P: 'async_trait + Compressor,
Self: 'async_trait,
'life0: 'async_trait,
fn write_packet<'life0, 'async_trait, P>(
&'life0 mut self,
compressor: P,
packet: Packet,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
P: 'async_trait + Compressor,
Self: 'async_trait,
'life0: 'async_trait,
Write a packet request, possibly compressing it. It is most likely unnecessary to implement this yourself.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.