Skip to content

Commit

Permalink
Add some more docs for serializing strings (#155)
Browse files Browse the repository at this point in the history
* Add some more docs for serializing strings

Namely, it clarifies that its being serialized under its bytewise
representation. Thought I'd add some comments here, just in case someone
was confused regarding the string encoding
  • Loading branch information
ValarDragon authored Dec 23, 2020
1 parent e00e554 commit 3856133
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions serialize/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ impl CanonicalDeserialize for usize {
}

// Implement Serialization for `String`
// It is serialized by obtaining its byte representation as a Vec<u8> and
// serializing that. This yields an end serialization of
// `string.len() || string_bytes`.
impl CanonicalSerialize for String {
#[inline]
fn serialize<W: Write>(&self, mut writer: W) -> Result<(), SerializationError> {
Expand Down

0 comments on commit 3856133

Please sign in to comment.