[][src]Struct rmp_serde::RawRef

pub struct RawRef<'a> { /* fields omitted */ }

Helper that allows both to encode and decode strings no matter whether they contain valid or invalid UTF-8.

Regardless of validity the UTF-8 content this type will always be serialized as a string.


impl<'a> RawRef<'a>[src]

pub fn new(v: &'a str) -> Self[src]

Constructs a new RawRef from the UTF-8 string.

pub fn from_utf8(v: &'a [u8]) -> Self[src]

Converts a vector of bytes to a RawRef.

pub fn is_str(&self) -> bool[src]

Returns true if the raw is valid UTF-8.

pub fn is_err(&self) -> bool[src]

Returns true if the raw contains invalid UTF-8 sequence.

pub fn as_str(&self) -> Option<&str>[src]

Returns the string reference if the raw is valid UTF-8, or else None.

pub fn as_err(&self) -> Option<&Utf8Error>[src]

Returns the underlying Utf8Error if the raw contains invalid UTF-8 sequence, or else None.

pub fn as_bytes(&self) -> &[u8][src]

Returns a byte slice of this raw's contents.

Trait Implementations

impl<'a> PartialEq<RawRef<'a>> for RawRef<'a>[src]

impl<'a> Clone for RawRef<'a>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a> Copy for RawRef<'a>[src]

impl<'a> Debug for RawRef<'a>[src]

impl<'a> Serialize for RawRef<'a>[src]

impl<'de> Deserialize<'de> for RawRef<'de>[src]

Auto Trait Implementations

impl<'a> Send for RawRef<'a>

impl<'a> Unpin for RawRef<'a>

impl<'a> Sync for RawRef<'a>

impl<'a> UnwindSafe for RawRef<'a>

impl<'a> RefUnwindSafe for RawRef<'a>

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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