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§

Formats the value using the given formatter. Read more

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.