Skip to main content

parse_location

Function parse_location 

Source
pub fn parse_location(query: &str) -> (&str, Option<Location>)
Expand description

Parse location from the end of a query string.

Returns the query without the location suffix, and the parsed location if found.

ยงExamples

use fff_query_parser::location::{parse_location, Location};

let (query, loc) = parse_location("file:12");
assert_eq!(query, "file");
assert_eq!(loc, Some(Location::Line(12)));

let (query, loc) = parse_location("search term");
assert_eq!(query, "search term");
assert_eq!(loc, None);