Parse key=value named flag support. (#3515)

This commit is contained in:
Andrés N. Robalino
2021-05-29 20:42:03 -05:00
committed by GitHub
parent bff81f24aa
commit 6fdfc84904
4 changed files with 189 additions and 63 deletions

View File

@ -525,6 +525,14 @@ impl Span {
Span { start, end }
}
pub fn new_option(start: usize, end: usize) -> Option<Span> {
if end >= start {
None
} else {
Some(Span { start, end })
}
}
/// Creates a `Span` with a length of 1 from the given position.
///
/// # Example