pub struct RedactedUrl<'a>(/* private fields */);Expand description
A URL rendered without its credentials, for logging.
A relay URL routinely carries an auth token in its query (?jwt=...), and any
URL may carry HTTP userinfo (https://user:pass@host/). Display prints only
the scheme, host, port, and path, so wrap every URL headed for a log line.
let url = url::Url::parse("https://user:pass@relay.example.com/anon/demo?jwt=secret").unwrap();
assert_eq!(RedactedUrl::new(&url).to_string(), "https://relay.example.com/anon/demo");Implementations§
Trait Implementations§
Source§impl<'a> Clone for RedactedUrl<'a>
impl<'a> Clone for RedactedUrl<'a>
Source§fn clone(&self) -> RedactedUrl<'a>
fn clone(&self) -> RedactedUrl<'a>
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 moreimpl<'a> Copy for RedactedUrl<'a>
Source§impl Debug for RedactedUrl<'_>
Delegates to Display so ?redacted in a log macro can’t
undo the redaction a derived impl would have printed straight through.
impl Debug for RedactedUrl<'_>
Delegates to Display so ?redacted in a log macro can’t
undo the redaction a derived impl would have printed straight through.
Auto Trait Implementations§
impl<'a> Freeze for RedactedUrl<'a>
impl<'a> RefUnwindSafe for RedactedUrl<'a>
impl<'a> Send for RedactedUrl<'a>
impl<'a> Sync for RedactedUrl<'a>
impl<'a> Unpin for RedactedUrl<'a>
impl<'a> UnsafeUnpin for RedactedUrl<'a>
impl<'a> UnwindSafe for RedactedUrl<'a>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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