diff options
author | Stuart Stock <stuart@int08h.com> | 2018-03-24 10:21:17 -0500 |
---|---|---|
committer | Stuart Stock <stuart@int08h.com> | 2018-03-24 10:21:17 -0500 |
commit | 32c4318b58d2c92588bbd2d052906171c6f6c4a4 (patch) | |
tree | 7e571904742771ab0144430046d200cc662fabce /src/message.rs | |
parent | 1ce57a140bcdd1c0c6dfbef1403a1aa11e2240ae (diff) | |
download | roughenough-32c4318b58d2c92588bbd2d052906171c6f6c4a4.zip |
add docstring for from_bytes()
Diffstat (limited to 'src/message.rs')
-rw-r--r-- | src/message.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/message.rs b/src/message.rs index 8766a8c..dce52e4 100644 --- a/src/message.rs +++ b/src/message.rs @@ -43,6 +43,12 @@ impl RtMessage { } } + /// Construct a new RtMessage from the on-the-wire representation in `bytes` + /// + /// ## Arguments + /// + /// * `bytes` - On-the-wire representation + /// pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error> { let mut msg = Cursor::new(bytes); @@ -88,6 +94,7 @@ impl RtMessage { // All offsets are relative to the end of the header, // which is our current position let header_end = msg.position() as usize; + // Compute the end of the last value, // as an offset from the end of the header let msg_end = bytes.len() - header_end; |