diff --git a/src/proto/message/unparsed.rs b/src/proto/message/unparsed.rs index a88f062..74c477f 100644 --- a/src/proto/message/unparsed.rs +++ b/src/proto/message/unparsed.rs @@ -16,6 +16,11 @@ impl Unparsed { let mut v = &self.0[..]; T::decode(&mut v) } + + /// Obtain the unparsed bytes as a `Vec`, consuming the `Unparsed` + pub fn into_bytes(self) -> Vec { + self.0 + } } impl From> for Unparsed { @@ -24,6 +29,12 @@ impl From> for Unparsed { } } +impl AsRef<[u8]> for Unparsed { + fn as_ref(&self) -> &[u8] { + self.0.as_ref() + } +} + impl Encode for Unparsed { fn encoded_len(&self) -> ssh_encoding::Result { Ok(self.0.len())