Struct PubSubClientAsync

Source
pub struct PubSubClientAsync { /* private fields */ }

Implementations§

Source§

impl PubSubClientAsync

A PubSubClientAsync is a structure to use redis publish/subscribe functionnality.

When creating a PubSubClientAsync it will automatically create a connection. Therefore when it is created it uses the host and the port.

Example:

let mut client = try!(redis_client::PubSubClientAsync::new("127.0.0.1", "6379"));
Source

pub fn new( host: &'static str, port: &'static str, ) -> Result<PubSubClientAsync, RedisError>

Source

pub fn exec_redis_command_async<F>( &mut self, redis_command: &mut RedisCommand, cmd_callback: F, pubsub_arg: PubSubArg, ) -> Result<(), RedisError>
where F: Fn(Result<RedisResult, RedisError>) + Send + 'static,

Execute a redis command. The cmd_callback will be called once the command execution is over and the pump method is called. The return value indicates if the command was successfully launched.

Source

pub fn pump(&mut self) -> Result<(), RedisError>

Pump the result and the received value and execute the callbacks with them. If no result or received value are ready this function will return.

Trait Implementations§

Source§

impl Debug for PubSubClientAsync

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for PubSubClientAsync

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PubSubCommandAsync for PubSubClientAsync

Source§

fn subscribe<C: ToString, G, S>( &mut self, channel: C, cmd_callback: G, callback: S, ) -> Result<(), RedisError>
where G: Send + 'static + Fn(Result<RedisResult, RedisError>), S: Send + 'static + Fn(RedisResult),

Source§

fn psubscribe<C: ToString, G, S>( &mut self, channel: C, cmd_callback: G, callback: S, ) -> Result<(), RedisError>
where G: Send + 'static + Fn(Result<RedisResult, RedisError>), S: Send + 'static + Fn(RedisResult),

Source§

fn publish<C: ToString, M: ToString, G>( &mut self, channel: C, message: M, cmd_callback: G, ) -> Result<(), RedisError>
where G: Send + 'static + Fn(Result<RedisResult, RedisError>),

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.