pub trait Connect: Sized {
// Required methods
fn connect<T>(info: T, timeout: Option<Duration>) -> RedisResult<Self>
where T: IntoConnectionInfo;
fn send_packed_command(&mut self, cmd: &[u8]) -> RedisResult<()>;
fn set_write_timeout(&self, dur: Option<Duration>) -> RedisResult<()>;
fn set_read_timeout(&self, dur: Option<Duration>) -> RedisResult<()>;
fn recv_response(&mut self) -> RedisResult<Value>;
}cluster only.Expand description
Implements the process of connecting to a Redis server and obtaining and configuring a connection handle.
Required Methods§
Sourcefn connect<T>(info: T, timeout: Option<Duration>) -> RedisResult<Self>where
T: IntoConnectionInfo,
fn connect<T>(info: T, timeout: Option<Duration>) -> RedisResult<Self>where
T: IntoConnectionInfo,
Connect to a node, returning handle for command execution.
Sourcefn send_packed_command(&mut self, cmd: &[u8]) -> RedisResult<()>
fn send_packed_command(&mut self, cmd: &[u8]) -> RedisResult<()>
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.
Sourcefn set_write_timeout(&self, dur: Option<Duration>) -> RedisResult<()>
fn set_write_timeout(&self, dur: Option<Duration>) -> RedisResult<()>
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.
Sourcefn set_read_timeout(&self, dur: Option<Duration>) -> RedisResult<()>
fn set_read_timeout(&self, dur: Option<Duration>) -> RedisResult<()>
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.
Sourcefn recv_response(&mut self) -> RedisResult<Value>
fn recv_response(&mut self) -> RedisResult<Value>
Fetches a single response from the connection. This is useful
if used in combination with send_packed_command.
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.