Trait rsmc_core::client::Connection [−][src]
pub trait Connection: Clone + Sized + Send + Sync + 'static {
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
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn read_packet<'life0, 'async_trait, P: Compressor>(
&'life0 mut self,
compressor: P
) -> Pin<Box<dyn Future<Output = Result<Packet, Error>> + Send + 'async_trait>>
where
P: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
{ ... }
fn write_packet<'life0, 'async_trait, P: Compressor>(
&'life0 mut self,
compressor: P,
packet: Packet
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where
P: 'async_trait,
'life0: 'async_trait,
Self: '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
Connect to a memcached server over TCP.
Read to fill the incoming buffer.
Provided methods
fn read_packet<'life0, 'async_trait, P: Compressor>(
&'life0 mut self,
compressor: P
) -> Pin<Box<dyn Future<Output = Result<Packet, Error>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn read_packet<'life0, 'async_trait, P: Compressor>(
&'life0 mut self,
compressor: P
) -> Pin<Box<dyn Future<Output = Result<Packet, Error>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Read a packet response, possibly decompressing it. It is most likely unnecessary to implement this yourself.
fn write_packet<'life0, 'async_trait, P: Compressor>(
&'life0 mut self,
compressor: P,
packet: Packet
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn write_packet<'life0, 'async_trait, P: Compressor>(
&'life0 mut self,
compressor: P,
packet: Packet
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
P: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Write a packet request, possibly compressing it. It is most likely unnecessary to implement this yourself.