pub struct Utils;
Implementations
sourceimpl Utils
impl Utils
sourcepub fn substring_after_scheme<'a>(parser: &Parser, input: &'a str) -> &'a str
pub fn substring_after_scheme<'a>(parser: &Parser, input: &'a str) -> &'a str
Get substring immediately after scheme.
Example
use url_parse::utils::Utils;
use url_parse::url::Parser;
let input =
"https://user:pass@www.example.co.uk:443/blog/article/search?docid=720&hl=en#dayone";
let expected =
"user:pass@www.example.co.uk:443/blog/article/search?docid=720&hl=en#dayone".to_string();
let parser = Parser::new(None);
let result = Utils::substring_after_scheme(&parser, input);
assert_eq!(result, expected);
sourcepub fn substring_after_login<'a>(parser: &Parser, input: &'a str) -> &'a str
pub fn substring_after_login<'a>(parser: &Parser, input: &'a str) -> &'a str
Get substring immediately after login. Eliminates scheme to ensure no colon present in remainder.
Example
use url_parse::utils::Utils;
use url_parse::url::Parser;
let input =
"https://user:pass@www.example.co.uk:443/blog/article/search?docid=720&hl=en#dayone";
let expected = "www.example.co.uk:443/blog/article/search?docid=720&hl=en#dayone".to_string();
let parser = Parser::new(None);
let result = Utils::substring_after_login(&parser, input);
assert_eq!(result, expected);
sourcepub fn substring_after_port<'a>(parser: &Parser, input: &'a str) -> &'a str
pub fn substring_after_port<'a>(parser: &Parser, input: &'a str) -> &'a str
Get substring immediately after port. Eliminates scheme to ensure no colon present in remainder.
Example
use url_parse::utils::Utils;
use url_parse::url::Parser;
let input =
"https://user:pass@www.example.co.uk:443/blog/article/search?docid=720&hl=en#dayone";
let expected = "www.example.co.uk:443/blog/article/search?docid=720&hl=en#dayone".to_string();
let parser = Parser::new(None);
let result = Utils::substring_after_login(&parser, input);
assert_eq!(result, expected);
sourcepub fn substring_before_port<'a>(parser: &Parser, input: &'a str) -> &'a str
pub fn substring_before_port<'a>(parser: &Parser, input: &'a str) -> &'a str
Get substring immediately before port.
Example
use url_parse::utils::Utils;
use url_parse::url::Parser;
let input = "https://www.example.co.uk:443/blog/article/search?docid=720&hl=en#dayone";
let expected = "https://www.example.co.uk".to_string();
let parser = Parser::new(None);
let result = Utils::substring_before_port(&parser, input);
assert_eq!(result, expected);
sourcepub fn substring_from_path_begin<'a>(parser: &Parser, input: &'a str) -> &'a str
pub fn substring_from_path_begin<'a>(parser: &Parser, input: &'a str) -> &'a str
Get substring before path. Eliminates scheme to ensure no colon present in remainder.
Example
use url_parse::utils::Utils;
use url_parse::url::Parser;
let input =
"https://user:pass@www.example.co.uk:443/blog/article/search?docid=720&hl=en#dayone";
let expected =
"user:pass@www.example.co.uk:443/blog/article/search?docid=720&hl=en#dayone".to_string();
let parser = Parser::new(None);
let result = Utils::substring_after_scheme(&parser, input);
assert_eq!(result, expected);
Auto Trait Implementations
impl RefUnwindSafe for Utils
impl Send for Utils
impl Sync for Utils
impl Unpin for Utils
impl UnwindSafe for Utils
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more