Seeking Guidance on Rust Lifetimes for TCP Byte Reassembly with Slices

From what I can tell from what you've provided, I think you can just remove some incorrect lifetime annotations (the 'a on &mut self).

 impl<'a> ReassemblerTestHarness<'a> {
-    pub(crate) fn submit_segment(&'a mut self, data: &'a [u8], index: u64, eof: bool) {
+    pub(crate) fn submit_segment(&mut self, data: &'a [u8], index: u64, eof: bool) {
  impl<'a> ReassemblerTestHarness<'a> {
-    pub(crate) fn submit_segment(&'a mut self, data: &'a [u8], index: u64, eof: bool) {
+    pub(crate) fn submit_segment(&mut self, data: &'a [u8], index: u64, eof: bool) {

Read my reply over here (and the links) for some explanation on why you got borrow checker errors.

1 Like