HostConnection

Trait HostConnection 

Source
pub trait HostConnection: Send {
    // Required methods
    fn open(
        &mut self,
        address: String,
    ) -> impl Future<Output = Result<Resource<Connection>, Error>> + Send;
    fn publish(
        &mut self,
        self_: Resource<Connection>,
        channel: String,
        payload: Payload,
    ) -> impl Future<Output = Result<(), Error>> + Send;
    fn get(
        &mut self,
        self_: Resource<Connection>,
        key: String,
    ) -> impl Future<Output = Result<Option<Payload>, Error>> + Send;
    fn set(
        &mut self,
        self_: Resource<Connection>,
        key: String,
        value: Payload,
    ) -> impl Future<Output = Result<(), Error>> + Send;
    fn incr(
        &mut self,
        self_: Resource<Connection>,
        key: String,
    ) -> impl Future<Output = Result<i64, Error>> + Send;
    fn del(
        &mut self,
        self_: Resource<Connection>,
        keys: Vec<String>,
    ) -> impl Future<Output = Result<u32, Error>> + Send;
    fn sadd(
        &mut self,
        self_: Resource<Connection>,
        key: String,
        values: Vec<String>,
    ) -> impl Future<Output = Result<u32, Error>> + Send;
    fn smembers(
        &mut self,
        self_: Resource<Connection>,
        key: String,
    ) -> impl Future<Output = Result<Vec<String>, Error>> + Send;
    fn srem(
        &mut self,
        self_: Resource<Connection>,
        key: String,
        values: Vec<String>,
    ) -> impl Future<Output = Result<u32, Error>> + Send;
    fn execute(
        &mut self,
        self_: Resource<Connection>,
        command: String,
        arguments: Vec<RedisParameter>,
    ) -> impl Future<Output = Result<Vec<RedisResult>, Error>> + Send;
    fn drop(
        &mut self,
        rep: Resource<Connection>,
    ) -> impl Future<Output = Result<()>> + Send;
}

Required Methods§

Source

fn open( &mut self, address: String, ) -> impl Future<Output = Result<Resource<Connection>, Error>> + Send

Open a connection to the Redis instance at address.

Source

fn publish( &mut self, self_: Resource<Connection>, channel: String, payload: Payload, ) -> impl Future<Output = Result<(), Error>> + Send

Publish a Redis message to the specified channel.

Source

fn get( &mut self, self_: Resource<Connection>, key: String, ) -> impl Future<Output = Result<Option<Payload>, Error>> + Send

Get the value of a key.

Source

fn set( &mut self, self_: Resource<Connection>, key: String, value: Payload, ) -> impl Future<Output = Result<(), Error>> + Send

Set key to value.

If key already holds a value, it is overwritten.

Source

fn incr( &mut self, self_: Resource<Connection>, key: String, ) -> impl Future<Output = Result<i64, Error>> + Send

Increments the number stored at key by one.

If the key does not exist, it is set to 0 before performing the operation. An error::type-error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer.

Source

fn del( &mut self, self_: Resource<Connection>, keys: Vec<String>, ) -> impl Future<Output = Result<u32, Error>> + Send

Removes the specified keys.

A key is ignored if it does not exist. Returns the number of keys deleted.

Source

fn sadd( &mut self, self_: Resource<Connection>, key: String, values: Vec<String>, ) -> impl Future<Output = Result<u32, Error>> + Send

Add the specified values to the set named key, returning the number of newly-added values.

Source

fn smembers( &mut self, self_: Resource<Connection>, key: String, ) -> impl Future<Output = Result<Vec<String>, Error>> + Send

Retrieve the contents of the set named key.

Source

fn srem( &mut self, self_: Resource<Connection>, key: String, values: Vec<String>, ) -> impl Future<Output = Result<u32, Error>> + Send

Remove the specified values from the set named key, returning the number of newly-removed values.

Source

fn execute( &mut self, self_: Resource<Connection>, command: String, arguments: Vec<RedisParameter>, ) -> impl Future<Output = Result<Vec<RedisResult>, Error>> + Send

Execute an arbitrary Redis command and receive the result.

Source

fn drop( &mut self, rep: Resource<Connection>, ) -> impl Future<Output = Result<()>> + Send

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.

Implementations on Foreign Types§

Source§

impl<_T: HostConnection + ?Sized + Send> HostConnection for &mut _T

Source§

fn open( &mut self, address: String, ) -> impl Future<Output = Result<Resource<Connection>, Error>> + Send

Open a connection to the Redis instance at address.

Source§

fn publish( &mut self, self_: Resource<Connection>, channel: String, payload: Payload, ) -> impl Future<Output = Result<(), Error>> + Send

Publish a Redis message to the specified channel.

Source§

fn get( &mut self, self_: Resource<Connection>, key: String, ) -> impl Future<Output = Result<Option<Payload>, Error>> + Send

Get the value of a key.

Source§

fn set( &mut self, self_: Resource<Connection>, key: String, value: Payload, ) -> impl Future<Output = Result<(), Error>> + Send

Set key to value.

If key already holds a value, it is overwritten.

Source§

fn incr( &mut self, self_: Resource<Connection>, key: String, ) -> impl Future<Output = Result<i64, Error>> + Send

Increments the number stored at key by one.

If the key does not exist, it is set to 0 before performing the operation. An error::type-error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer.

Source§

fn del( &mut self, self_: Resource<Connection>, keys: Vec<String>, ) -> impl Future<Output = Result<u32, Error>> + Send

Removes the specified keys.

A key is ignored if it does not exist. Returns the number of keys deleted.

Source§

fn sadd( &mut self, self_: Resource<Connection>, key: String, values: Vec<String>, ) -> impl Future<Output = Result<u32, Error>> + Send

Add the specified values to the set named key, returning the number of newly-added values.

Source§

fn smembers( &mut self, self_: Resource<Connection>, key: String, ) -> impl Future<Output = Result<Vec<String>, Error>> + Send

Retrieve the contents of the set named key.

Source§

fn srem( &mut self, self_: Resource<Connection>, key: String, values: Vec<String>, ) -> impl Future<Output = Result<u32, Error>> + Send

Remove the specified values from the set named key, returning the number of newly-removed values.

Source§

fn execute( &mut self, self_: Resource<Connection>, command: String, arguments: Vec<RedisParameter>, ) -> impl Future<Output = Result<Vec<RedisResult>, Error>> + Send

Execute an arbitrary Redis command and receive the result.

Source§

async fn drop(&mut self, rep: Resource<Connection>) -> Result<()>

Implementors§