[−][src]Struct trezm_redis::Msg
Represents a pubsub message.
Methods
impl Msg
[src]
This holds the data that comes from listening to a pubsub connection. It only contains actual message data.
pub fn from_value(value: &Value) -> Option<Self>
[src]
pub fn get_channel<T: FromRedisValue>(&self) -> RedisResult<T>
[src]
Returns the channel this message came on.
pub fn get_channel_name(&self) -> &str
[src]
Convenience method to get a string version of the channel. Unless
your channel contains non utf-8 bytes you can always use this
method. If the channel is not a valid string (which really should
not happen) then the return value is "?"
.
pub fn get_payload<T: FromRedisValue>(&self) -> RedisResult<T>
[src]
Returns the message's payload in a specific format.
pub fn get_payload_bytes(&self) -> &[u8]
[src]
Returns the bytes that are the message's payload. This can be used
as an alternative to the get_payload
function if you are interested
in the raw bytes in it.
pub fn from_pattern(&self) -> bool
[src]
Returns true if the message was constructed from a pattern subscription.
pub fn get_pattern<T: FromRedisValue>(&self) -> RedisResult<T>
[src]
If the message was constructed from a message pattern this can be
used to find out which one. It's recommended to match against
an Option<String>
so that you do not need to use from_pattern
to figure out if a pattern was set.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Msg
impl Send for Msg
impl Sync for Msg
impl Unpin for Msg
impl UnwindSafe for Msg
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>,