pub struct UnregisteredScheme<'scheme> { /* private fields */ }
Expand description

A scheme that is not in the registered schemes.

This is case-insensitive, and this is reflected in the equality and hash functions.

Implementations

Returns a new unregistered scheme which is identical but has a lifetime tied to this unregistered scheme.

Returns a str representation of the scheme.

The case-sensitivity of the original string is preserved.

Examples
use std::convert::TryFrom;

use uriparse::UnregisteredScheme;

let scheme = UnregisteredScheme::try_from("TEST-scheme").unwrap();
assert_eq!(scheme.as_str(), "TEST-scheme");

Converts the UnregisteredScheme into an owned copy.

If you construct the scheme from a source with a non-static lifetime, you may run into lifetime problems due to the way the struct is designed. Calling this function will ensure that the returned value has a static lifetime.

This is different from just cloning. Cloning the scheme will just copy the references, and thus the lifetime will remain the same.

Returns whether the scheme is normalized.

A normalized scheme will be all lowercase.

This function runs in constant-time.

Examples
use std::convert::TryFrom;

use uriparse::UnregisteredScheme;

let scheme = UnregisteredScheme::try_from("myscheme").unwrap();
assert!(scheme.is_normalized());

let mut scheme = UnregisteredScheme::try_from("MyScHeMe").unwrap();
assert!(!scheme.is_normalized());
scheme.normalize();
assert!(scheme.is_normalized());

Normalizes the scheme so that it is all lowercase.

Examples
use std::convert::TryFrom;

use uriparse::UnregisteredScheme;

let mut scheme = UnregisteredScheme::try_from("myscheme").unwrap();
scheme.normalize();
assert_eq!(scheme, "myscheme");

let mut scheme = UnregisteredScheme::try_from("MyScHeMe").unwrap();
scheme.normalize();
assert_eq!(scheme, "myscheme");

Trait Implementations

Performs the conversion.

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

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.