-
-
Save rust-play/c832935c059c5168ce201feed76c73e4 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn nom_str_until_eol(i: &str) -> nom::IResult<&str, &str> { | |
let first_line = i.lines().next(); | |
if let Some(first_line) = first_line { | |
let rest = &i[first_line.len()..]; | |
let rest = rest.trim(); | |
Ok((rest, first_line)) | |
} else { | |
Ok((i, "")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment