[−][src]Struct rmp_serde::Raw
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.
Implementations
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 Clone for Raw
[src]
impl Debug for Raw
[src]
impl<'de> Deserialize<'de> for Raw
[src]
fn deserialize<D>(de: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl PartialEq<Raw> for Raw
[src]
impl Serialize for Raw
[src]
impl StructuralPartialEq for Raw
[src]
Auto Trait Implementations
impl RefUnwindSafe for Raw
impl Send for Raw
impl Sync for Raw
impl Unpin for Raw
impl UnwindSafe for Raw
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,