From 2c27b1034b3aa106b9c1721d1d19d1e964340d88 Mon Sep 17 00:00:00 2001 From: Evgeny Safronov Date: Tue, 12 Sep 2017 23:47:11 +0300 Subject: [PATCH] chore: style and docs --- rmp-serde/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rmp-serde/src/lib.rs b/rmp-serde/src/lib.rs index 0c16a02f..d7ad7da3 100644 --- a/rmp-serde/src/lib.rs +++ b/rmp-serde/src/lib.rs @@ -225,7 +225,10 @@ impl<'de> Deserialize<'de> for Raw { } } -/// Helper that allows to decode strings no matter whether they contain valid or invalid UTF-8. +/// 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. #[derive(Clone, Copy, Debug, PartialEq)] pub struct RawRef<'a> { s: Result<&'a str, (&'a [u8], Utf8Error)>, @@ -238,7 +241,7 @@ impl<'a> RawRef<'a> { } /// Converts a vector of bytes to a `RawRef`. - pub fn from_utf8(v: &'a[u8]) -> Self { + pub fn from_utf8(v: &'a [u8]) -> Self { match str::from_utf8(v) { Ok(v) => RawRef::new(v), Err(err) => {