use crate::{
RedactValueMut,
RedactionPolicy,
};
pub trait RedactMapValueMut<K: ?Sized, V: ?Sized> {
fn redact_map_in_place(&mut self, policy: &RedactionPolicy);
}
impl<M: ?Sized, K: ?Sized, V: ?Sized> RedactMapValueMut<K, V> for M
where
for<'a> &'a mut M: IntoIterator<Item = (&'a K, &'a mut V)>,
K: AsRef<str>,
V: RedactValueMut,
{
#[inline]
fn redact_map_in_place(&mut self, policy: &RedactionPolicy) {
for (key, value) in self {
if let Some(level) = policy.sensitivity_for(key.as_ref()) {
value.redact_value_in_place(level, policy.masking());
}
}
}
}