fn foo<'a, ParseArgs, P: ParsablePacket<&'a [u8], ParseArgs>>(&'a mut self, args: ParseArgs) -> Result { let old_prefix_len = self.prefix_len(); let old_suffix_len = self.suffix_len(); let packet = self.parse_with::<_, P>(args)?; if todo!() { let new_prefix_len = self.prefix_len(); let new_suffix_len = self.suffix_len(); self.grow_front(old_prefix_len - new_prefix_len); self.grow_back(old_prefix_len - new_prefix_len); todo!() // TODO: Update return type } todo!() // TODO: Update return type // fn undo_parse(&mut self, meta: ParseMetadata) { // if self.len() < meta.body_len { // // There were padding bytes which were stripped when parsing the // // encapsulated packet. We need to add them back in order to restore // // the original packet. // let len = self.len(); // self.grow_back(meta.body_len - len); // } // self.grow_front(meta.header_len); // self.grow_back(meta.footer_len); // } // pub trait ParseBuffer: ShrinkBuffer + ContiguousBuffer { // fn parse<'a, P: ParsablePacket<&'a [u8], ()>>(&'a mut self) -> Result { // self.parse_with(()) // } // fn parse_with<'a, ParseArgs, P: ParsablePacket<&'a [u8], ParseArgs>>( // &'a mut self, // args: ParseArgs, // ) -> Result; // } // pub trait ParseBufferMut: ParseBuffer + FragmentedBufferMut + ContiguousBufferMut { // fn parse_mut<'a, P: ParsablePacket<&'a mut [u8], ()>>(&'a mut self) -> Result { // self.parse_with_mut(()) // } // fn parse_with_mut<'a, ParseArgs, P: ParsablePacket<&'a mut [u8], ParseArgs>>( // &'a mut self, // args: ParseArgs, // ) -> Result; // } }