pub struct UrlHostRedactor;Expand description
Redact URLs, removing the scheme, hostname, port, auth, query values, and fragments.
use apollo_redaction::Redacted;
use apollo_redaction::strategy::UrlHostRedactor;
fn url(input: &str) -> String {
Redacted::<_, UrlHostRedactor>::new(input).to_string()
}
assert_eq!(url("https://example.com/api/secret"), "****/api/secret");
assert_eq!(url("https://example.com"), "****");
assert_eq!(url("postgres://user:pass@host/db"), "****/db");
assert_eq!(url("https://example.com/api?key=secret"), "****/api?key=****");
assert_eq!(url("https://example.com/page#section"), "****/page#****");Trait Implementations§
Source§impl Clone for UrlHostRedactor
impl Clone for UrlHostRedactor
Source§fn clone(&self) -> UrlHostRedactor
fn clone(&self) -> UrlHostRedactor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for UrlHostRedactor
impl Default for UrlHostRedactor
Source§fn default() -> UrlHostRedactor
fn default() -> UrlHostRedactor
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for UrlHostRedactor
impl RefUnwindSafe for UrlHostRedactor
impl Send for UrlHostRedactor
impl Sync for UrlHostRedactor
impl Unpin for UrlHostRedactor
impl UnsafeUnpin for UrlHostRedactor
impl UnwindSafe for UrlHostRedactor
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