pub struct Utils;

Implementations

Get substring immediately after scheme.

Example
use url_parse::utils::Utils;
use url_parse::core::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);

Get substring immediately after login. Eliminates scheme to ensure no colon present in remainder.

Example
use url_parse::utils::Utils;
use url_parse::core::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);

Get substring immediately after port. Eliminates scheme to ensure no colon present in remainder.

Example
use url_parse::utils::Utils;
use url_parse::core::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);

Get substring immediately before port.

Example
use url_parse::utils::Utils;
use url_parse::core::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);

Get substring before path. Eliminates scheme to ensure no colon present in remainder.

Example
use url_parse::utils::Utils;
use url_parse::core::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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.