[−][src]Struct rmp_serde::RawRef
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<'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> Clone for RawRef<'a>[src]
impl<'a> Copy for RawRef<'a>[src]
impl<'a> Debug for RawRef<'a>[src]
impl<'de> Deserialize<'de> for RawRef<'de>[src]
fn deserialize<D>(de: D) -> Result<Self, D::Error> where
D: Deserializer<'de>, [src]
D: Deserializer<'de>,
impl<'a> PartialEq<RawRef<'a>> for RawRef<'a>[src]
impl<'a> Serialize for RawRef<'a>[src]
impl<'a> StructuralPartialEq for RawRef<'a>[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for RawRef<'a>
impl<'a> Send for RawRef<'a>
impl<'a> Sync for RawRef<'a>
impl<'a> Unpin for RawRef<'a>
impl<'a> UnwindSafe for RawRef<'a>
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> 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>,