diff --git a/src/lib.rs b/src/lib.rs index 9ff7db2..860048f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,7 +16,7 @@ impl<'a> From for KError<'a> { pub type KResult<'a, T> = Result>; pub trait KStruct<'a> { - type Parent: ?KStruct<'a>; + type Parent: KStruct<'a>; type Root: KStruct<'a>; /// Create a new instance of this struct; if we are the root node, @@ -68,8 +68,6 @@ pub trait KStream { eos_error: bool, ) -> io::Result<&[u8]>; - /// Verify a magic sequence occurs in the file. Because the size is known at compile-time - /// (and is generally very small), we ask that our caller pass in a buffer for us. fn ensure_fixed_contents(&mut self, expected: &[u8]) -> KResult<&[u8]> { let actual = self.read_bytes(expected.len())?; if actual == expected { @@ -83,8 +81,7 @@ pub trait KStream { } /// Return a byte array that is sized to exclude all trailing instances of the - /// padding character. Because this operation is immutable on the underlying byte slice, - /// we don't allocate a second buffer. + /// padding character. fn bytes_strip_right(bytes: &[u8], pad: u8) -> &[u8] { let mut new_len = bytes.len(); while new_len > 0 && bytes[new_len - 1] == pad { @@ -95,8 +92,6 @@ pub trait KStream { /// Return a byte array that contains all bytes up until the /// termination byte. Can optionally include the termination byte as well. - /// Because this operation is immutable on the underlying byte slice, - /// we don't allocate a second buffer. fn bytes_terminate(bytes: &[u8], term: u8, include_term: bool) -> &[u8] { let mut new_len = 0; while bytes[new_len] != term && new_len < bytes.len() {