pub struct RawRef<'a> { /* private fields */ }
Expand description
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
sourceimpl<'a> RawRef<'a>
impl<'a> RawRef<'a>
sourcepub fn from_utf8(v: &'a [u8]) -> Self
👎 Deprecated: This implementation is unsound and dangerous. See https://github.com/3Hren/msgpack-rust/issues/305
pub fn from_utf8(v: &'a [u8]) -> Self
This implementation is unsound and dangerous. See https://github.com/3Hren/msgpack-rust/issues/305
DO NOT USE. See https://github.com/3Hren/msgpack-rust/issues/305
sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Returns the string reference if the raw is valid UTF-8, or else None
.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for RawRef<'de>
impl<'de> Deserialize<'de> for RawRef<'de>
sourcefn deserialize<D>(de: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(de: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<'a> Copy for RawRef<'a>
impl<'a> StructuralPartialEq for RawRef<'a>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more