Struct Options

Source
pub struct Options {
Show 16 fields pub default_protocol: String, pub normalize_protocol: bool, pub force_http: bool, pub force_https: bool, pub strip_authentication: bool, pub strip_hash: bool, pub strip_protocol: bool, pub strip_text_fragment: bool, pub strip_www: bool, pub remove_query_parameters: RemoveQueryParametersOptions, pub keep_query_parameters: Option<Vec<Regex>>, pub remove_trailing_slash: bool, pub remove_single_slash: bool, pub remove_directory_index: RemoveDirectoryIndexOptions, pub remove_explicit_port: bool, pub sort_query_parameters: bool,
}
Expand description

Normalization options.

Fields§

§default_protocol: String

Default protocol.

Default value: http.

§normalize_protocol: bool

Prepend defaultProtocol to the URL if it’s protocol-relative.

Default value: true.

§force_http: bool

Normalize HTTPS to HTTP.

Default value: false.

§force_https: bool

Normalize HTTP to HTTPS.

This option cannot be used with the force_http option at the same time.

Default value: false.

§strip_authentication: bool

Strip the authentication part of the URL.

Default value: true.

§strip_hash: bool

Strip the hash part of the URL.

Default value: false.

§strip_protocol: bool

Remove the protocol from the URL: http://sindresorhus.comsindresorhus.com.

It will only remove https:// and http:// protocols.

Default value: false.

§strip_text_fragment: bool

Strip the text fragment part of the URL.

Note: The text fragment will always be removed if the strip_hash option is set to true, as the hash contains the text fragment.

Default value: true.

§strip_www: bool

Remove www. from the URL.

Default value: true.

§remove_query_parameters: RemoveQueryParametersOptions

Remove query parameters that matches any of the provided strings or regexes.

Default value: ^utm_\w+.

§keep_query_parameters: Option<Vec<Regex>>

Keeps only query parameters that matches any of the provided strings or regexes.

Note: It overrides the remove_query_parameters option.

Default value: None.

§remove_trailing_slash: bool

Remove trailing slash.

Note: Trailing slash is always removed if the URL doesn’t have a pathname unless the remove_single_slash option is set to false.

Default value: true.

§remove_single_slash: bool

Remove a sole / pathname in the output. This option is independent of remove_trailing_slash.

Default value: true.

§remove_directory_index: RemoveDirectoryIndexOptions

Removes the default directory index file from path that matches any of the provided strings or regexes. When true, the regex ^index\.[a-z]+$ is used.

Default value: None.

§remove_explicit_port: bool

Removes an explicit port number from the URL.

Port 443 is always removed from HTTPS URLs and 80 is always removed from HTTP URLs regardless of this option.

Default value: false.

§sort_query_parameters: bool

Sorts the query parameters alphabetically by key.

Default value: true.

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Options

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T