Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created August 31, 2020 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/7a8308d32de2eafbe28f3cc168a1daed to your computer and use it in GitHub Desktop.
Save rust-play/7a8308d32de2eafbe28f3cc168a1daed to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
struct TOCSectionEntry {
sub_entries: Vec<TOCSectionEntry>,
}
fn table_to_insert_to<'a>(
mut level: Option<&'a mut TOCSectionEntry>,
) -> Option<&'a mut TOCSectionEntry> {
while let Some(next) = level {
level = next.sub_entries.last_mut();
}
level
}
fn main() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment