pub struct IpRedactor;Expand description
Redact IPv4 and IPv6 addresses.
§IPv4
The first two octets are shown.
use apollo_redaction::Redacted;
use apollo_redaction::strategy::IpRedactor;
let ip = Redacted::<_, IpRedactor>::new("192.168.1.100");
assert_eq!(
format!("private ip is {ip}"),
"private ip is 192.168.*.*",
);§IPv6
The first four groups are shown.
use apollo_redaction::Redacted;
use apollo_redaction::strategy::IpRedactor;
let ip = Redacted::<_, IpRedactor>::new("4fd3:694a:d3f4:c465:9b17:18af:e6ae:a243");
assert_eq!(
format!("private ip is {ip}"),
"private ip is 4fd3:694a:d3f4:c465:****:****:****:****",
);Trait Implementations§
Source§impl Clone for IpRedactor
impl Clone for IpRedactor
Source§fn clone(&self) -> IpRedactor
fn clone(&self) -> IpRedactor
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 IpRedactor
impl Default for IpRedactor
Source§fn default() -> IpRedactor
fn default() -> IpRedactor
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for IpRedactor
impl RefUnwindSafe for IpRedactor
impl Send for IpRedactor
impl Sync for IpRedactor
impl Unpin for IpRedactor
impl UnsafeUnpin for IpRedactor
impl UnwindSafe for IpRedactor
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