[][src]Struct rmp_serde::Raw

pub struct Raw { /* 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.

Methods

impl Raw[src]

pub fn new(v: String) -> Self[src]

Constructs a new Raw from the UTF-8 string.

pub fn from_utf8(v: Vec<u8>) -> Self[src]

Converts a vector of bytes to a Raw.

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.

pub fn into_str(self) -> Option<String>[src]

Consumes this object, yielding the string if the raw is valid UTF-8, or else None.

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

Converts a Raw into a byte vector.

Trait Implementations

impl PartialEq<Raw> for Raw[src]

impl Clone for Raw[src]

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

Performs copy-assignment from source. Read more

impl Debug for Raw[src]

impl Serialize for Raw[src]

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

Auto Trait Implementations

impl Send for Raw

impl Unpin for Raw

impl Sync for Raw

impl UnwindSafe for Raw

impl RefUnwindSafe for Raw

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]