pub struct UrlCleaner { /* private fields */ }Expand description
A UrlCleaner can remove tracking parameters from URLs.
This struct is relatively expensive to construct because it needs to parse the rules from JSON. It’s recommended to create one per application and reuse it.
Implementations§
Source§impl UrlCleaner
impl UrlCleaner
Sourcepub fn from_rules_path(path: &Path) -> Result<Self, Error>
Available on crate feature std only.
pub fn from_rules_path(path: &Path) -> Result<Self, Error>
std only.Sourcepub fn from_rules_file<R: Read>(reader: R) -> Result<Self, Error>
Available on crate feature std only.
pub fn from_rules_file<R: Read>(reader: R) -> Result<Self, Error>
std only.Sourcepub fn from_embedded_rules() -> Result<Self, Error>
pub fn from_embedded_rules() -> Result<Self, Error>
Sourcepub fn strip_referral_marketing(self, value: bool) -> Self
pub fn strip_referral_marketing(self, value: bool) -> Self
Configure whether you want to strip referral codes and similar parameters.
While they can be considered to be tracking, they are useful on occasion.
The default is false, meaning these are kept.
Sourcepub fn clear_single_url_str<'a>(
&self,
url: &'a str,
) -> Result<Cow<'a, str>, Error>
pub fn clear_single_url_str<'a>( &self, url: &'a str, ) -> Result<Cow<'a, str>, Error>
Clean a single URL.
The argument is a string that is just a URL, with no text around.
The Cleaning may involve
-
- removing tracking parameters and/or,
-
- detecting redirections with the target url in a query parameters
§Returns
a cleaned URL
§Errors
If an error occurred. See the Error enum for possible reasons.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UrlCleaner
impl RefUnwindSafe for UrlCleaner
impl Send for UrlCleaner
impl Sync for UrlCleaner
impl Unpin for UrlCleaner
impl UnwindSafe for UrlCleaner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more