[−][src]Struct redis::Connection
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]
Creats a pubsub instance.for this connection.
Trait Implementations
impl ConnectionLike for Connection[src]
fn req_packed_command(&mut self, cmd: &[u8]) -> RedisResult<Value>[src]
fn req_packed_commands(
&mut self,
cmd: &[u8],
offset: usize,
count: usize
) -> RedisResult<Vec<Value>>[src]
&mut self,
cmd: &[u8],
offset: usize,
count: usize
) -> RedisResult<Vec<Value>>
fn get_db(&self) -> i64[src]
fn is_open(&self) -> bool[src]
fn check_connection(&mut self) -> bool[src]
impl PubSubCommands for Connection[src]
fn subscribe<C, F, U>(&mut self, channels: C, func: F) -> RedisResult<U> where
F: FnMut(Msg) -> ControlFlow<U>,
C: ToRedisArgs, [src]
F: FnMut(Msg) -> ControlFlow<U>,
C: ToRedisArgs,
fn psubscribe<P, F, U>(&mut self, patterns: P, func: F) -> RedisResult<U> where
F: FnMut(Msg) -> ControlFlow<U>,
P: ToRedisArgs, [src]
F: FnMut(Msg) -> ControlFlow<U>,
P: ToRedisArgs,
Auto Trait Implementations
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnwindSafe for Connection
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,