1use crate::core::Parser;
2
3impl Parser {
4 pub fn anchor<'a>(&self, input: &'a str) -> Option<&'a str> {
14 let position_anchor = input.find('#');
15 if let Some(v) = position_anchor {
16 let after = &input[v + 1..];
17 return Some(after);
18 }
19 None
20 }
21}
22
23#[cfg(test)]
24mod tests {
25 use super::*;
26
27 #[test]
28 fn test_anchor_works_when_typical() {
29 let input = "https://www.example.co.uk:443/blog/article/search?docid=720&hl=en#dayone";
30 let result = Parser::new(None).anchor(input).unwrap();
31 assert_eq!(result, "dayone");
32 }
33}