79833107

Date: 2025-11-29 07:26:33
Score: 0.5
Natty:
Report link

I solved this by not using a reference in the struct and using the Option::take function to move it out.

self.scanner = Some(Scanner::new(source));
self.chunk = Some(Chunk::new());
...
self.scanner = None;
let chunk = self.chunk.take().expect("How'd the chunk disappear, something really bad happend ig?");
Ok(chunk)

This was pretty self-explanatory and I should've held off on asking this question but it would still be good to see how someone else would do this?

Reasons:
  • Whitelisted phrase (-2): I solved
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: NongusStudios