pub trait Driver:
    Clone
    + Send
    + Sync
    + 'static {
    type Error: Error + Send + 'static;
    // Required methods
    fn publish(
        &self,
        chan: String,
        val: Vec<u8>,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn subscribe(
        &self,
        chan: String,
        size: usize,
    ) -> impl Future<Output = Result<MessageStream<ChanItem>, Self::Error>> + Send;
    fn unsubscribe(
        &self,
        pat: String,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn num_serv(
        &self,
        chan: &str,
    ) -> impl Future<Output = Result<u16, Self::Error>> + Send;
}Expand description
The driver trait can be used to support different pub/sub backends. It must share handlers/connection between its clones.
Required Associated Types§
Required Methods§
Sourcefn publish(
    &self,
    chan: String,
    val: Vec<u8>,
) -> impl Future<Output = Result<(), Self::Error>> + Send
 
fn publish( &self, chan: String, val: Vec<u8>, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Publish a message to a channel.
Sourcefn subscribe(
    &self,
    chan: String,
    size: usize,
) -> impl Future<Output = Result<MessageStream<ChanItem>, Self::Error>> + Send
 
fn subscribe( &self, chan: String, size: usize, ) -> impl Future<Output = Result<MessageStream<ChanItem>, Self::Error>> + Send
Subscribe to a channel, it will return a stream of messages. The size parameter is the buffer size of the channel.
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.
Implementors§
Source§impl Driver for ClusterDriver
Available on crate features redis and redis-cluster only. 
impl Driver for ClusterDriver
Available on crate features 
redis and redis-cluster only.type Error = RedisError
Source§impl Driver for RedisDriver
Available on crate feature redis only. 
impl Driver for RedisDriver
Available on crate feature 
redis only.