[][src]Struct trezm_redis::Connection

pub struct Connection { /* fields omitted */ }

Represents a stateful redis TCP connection.

Methods

impl Connection[src]

A connection is an object that represents a single redis connection. It provides basic support for sending encoded commands into a redis connection and to read a response from it. It's bound to a single database and can only be created from the client.

You generally do not much with this object other than passing it to Cmd objects.

pub fn send_packed_command(&mut self, cmd: &[u8]) -> RedisResult<()>[src]

Sends an already encoded (packed) command into the TCP socket and does not read a response. This is useful for commands like MONITOR which yield multiple items. This needs to be used with care because it changes the state of the connection.

pub fn recv_response(&mut self) -> RedisResult<Value>[src]

Fetches a single response from the connection. This is useful if used in combination with send_packed_command.

pub fn set_write_timeout(&self, dur: Option<Duration>) -> RedisResult<()>[src]

Sets the write timeout for the connection.

If the provided value is None, then send_packed_command call will block indefinitely. It is an error to pass the zero Duration to this method.

pub fn set_read_timeout(&self, dur: Option<Duration>) -> RedisResult<()>[src]

Sets the read timeout for the connection.

If the provided value is None, then recv_response call will block indefinitely. It is an error to pass the zero Duration to this method.

pub fn as_pubsub(&mut self) -> PubSub[src]

Creates a PubSub instance for this connection.

Trait Implementations

impl ConnectionLike for Connection[src]

impl PubSubCommands for Connection[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,