Skip to content

Commit

Permalink
chore: style and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
3Hren committed Sep 12, 2017
1 parent 4f4952c commit 2c27b10
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rmp-serde/src/lib.rs
Expand Up @@ -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)>,
Expand All @@ -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) => {
Expand Down

0 comments on commit 2c27b10

Please sign in to comment.