Struct OptionsBuilder

Source
pub struct OptionsBuilder { /* private fields */ }
Expand description

Builder for Options.

Implementations§

Source§

impl OptionsBuilder

Source

pub fn default_protocol<VALUE: Into<String>>( &mut self, value: VALUE, ) -> &mut Self

Default protocol.

Default value: http.

Source

pub fn normalize_protocol<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self

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

Default value: true.

Source

pub fn force_http<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Normalize HTTPS to HTTP.

Default value: false.

Source

pub fn force_https<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Normalize HTTP to HTTPS.

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

Default value: false.

Source

pub fn strip_authentication<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self

Strip the authentication part of the URL.

Default value: true.

Source

pub fn strip_hash<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Strip the hash part of the URL.

Default value: false.

Source

pub fn strip_protocol<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

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

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

Default value: false.

Source

pub fn strip_text_fragment<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self

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.

Source

pub fn strip_www<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

Remove www. from the URL.

Default value: true.

Source

pub fn remove_query_parameters<VALUE: Into<RemoveQueryParametersOptions>>( &mut self, value: VALUE, ) -> &mut Self

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

Default value: ^utm_\w+.

Source

pub fn keep_query_parameters<VALUE: Into<Option<Vec<Regex>>>>( &mut self, value: VALUE, ) -> &mut Self

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

Note: It overrides the remove_query_parameters option.

Default value: None.

Source

pub fn remove_trailing_slash<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self

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.

Source

pub fn remove_single_slash<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self

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

Default value: true.

Source

pub fn remove_directory_index<VALUE: Into<RemoveDirectoryIndexOptions>>( &mut self, value: VALUE, ) -> &mut Self

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.

Source

pub fn remove_explicit_port<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self

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.

Source

pub fn sort_query_parameters<VALUE: Into<bool>>( &mut self, value: VALUE, ) -> &mut Self

Sorts the query parameters alphabetically by key.

Default value: true.

Source

pub fn build(&self) -> Result<Options, OptionsBuilderError>

Builds a new Options.

§Errors

If a required field has not been initialized.

Trait Implementations§

Source§

impl Clone for OptionsBuilder

Source§

fn clone(&self) -> OptionsBuilder

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 Default for OptionsBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. 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