Skip to content

Instantly share code, notes, and snippets.

@derrickturk
Created January 22, 2023 20:12
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 derrickturk/9523818feb18215e28f1e95e2b657d04 to your computer and use it in GitHub Desktop.
Save derrickturk/9523818feb18215e28f1e95e2b657d04 to your computer and use it in GitHub Desktop.
"Uncons" a char from a Rust &str
#[inline]
fn pop_char(s: &str) -> Option<(char, &str)> {
let mut chars = s.chars();
chars.next().map(|c| (c, chars.as_str()))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment