[][src]Struct rsmq_async::RedisBytes

pub struct RedisBytes(_);

Internal value representing the redis bytes. It implements TryFrom String and Vec and From String, &str, Vec and &u8 to itself.

You can add your custom TryFrom and From implementation in order to make automatically transform you value to yours when executing a command in redis.

As example, the current String implementation:

use std::convert::TryFrom;
use rsmq_async::RedisBytes;
  
impl TryFrom<RedisBytes> for String {
    type Error = Vec<u8>;

    fn try_from(bytes: RedisBytes) -> Result<Self, Self::Error> {
        // For the library user, they can just call into_bytes
        // for getting the original Vec<u8>
        String::from_utf8(bytes.0).map_err(|e| e.into_bytes())
    }
}

Implementations

impl RedisBytes[src]

pub fn into_bytes(self) -> Vec<u8>[src]

Consumes the value and returns the raw bytes as Vec

Trait Implementations

impl Debug for RedisBytes[src]

impl From<&'_ [u8]> for RedisBytes[src]

impl From<&'_ str> for RedisBytes[src]

impl From<String> for RedisBytes[src]

impl From<Vec<u8, Global>> for RedisBytes[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,