[−][src]Struct redis_asio::RedisCoreConnection
Actual Redis connection converts packets from RESP
packets into RedisValue
and from RedisCommand
into RESP
packets.
Example
use std::net::SocketAddr; use futures::Future; use redis_asio::{RedisCoreConnection, RedisValue, command, from_redis_value}; let address = &"127.0.0.1:6379".parse::<SocketAddr>().unwrap(); let set_req = command("SET").arg("foo").arg(123); let get_req = command("GET").arg("foo"); let future = RedisCoreConnection::connect(address) .and_then(move |con| con.send(set_req)) .and_then(|(con, response)| { assert_eq!(RedisValue::Ok, response, "Expect Ok"); con.send(get_req) }) .map(move |(_, response)| assert_eq!(123, from_redis_value(&response).unwrap())) .map_err(|_| unreachable!()); tokio::run(future);
Methods
impl RedisCoreConnection
[src]
pub fn connect(
addr: &SocketAddr
) -> impl Future<Item = Self, Error = RedisError>
[src]
addr: &SocketAddr
) -> impl Future<Item = Self, Error = RedisError>
Open a connection to Redis server and wrap it into RedisCoreConnection
,
that will be available in the future.
pub fn send(self, req: RedisCommand) -> Send
[src]
Send request as a RedisCommand
and return Send
represents the future
Future<Item=(RedisCoreConnection, RedisValue), Error=RedisError>
Auto Trait Implementations
impl !RefUnwindSafe for RedisCoreConnection
impl Send for RedisCoreConnection
impl !Sync for RedisCoreConnection
impl Unpin for RedisCoreConnection
impl !UnwindSafe for RedisCoreConnection
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>,