Struct RedactingSerializer
pub struct RedactingSerializer<'a> { /* private fields */ }Expand description
CanonicalJsonObject serializer that redacts fields on the fly.
The main use case for this is to compute the hashes or signatures of an event, where the event needs to be redacted and have a few other fields removed.
This avoids having to .clone() a CanonicalJsonObject, and then to
redact() it and potentially remove other fields, and serialize it with
serde_json::to_vec().
Implementations§
§impl<'a> RedactingSerializer<'a>
impl<'a> RedactingSerializer<'a>
pub fn new() -> RedactingSerializer<'a>
pub fn new() -> RedactingSerializer<'a>
Construct a new RedactingSerializer that doesn’t redact anything.
pub fn rules(self, rules: &'a RedactionRules) -> RedactingSerializer<'a>
pub fn rules(self, rules: &'a RedactionRules) -> RedactingSerializer<'a>
Add the redaction rules to apply.
If this is set, the object to serialize must be an event with a type field.
pub fn custom_redacted_root_fields(
self,
fields: &'a [&'a str],
) -> RedactingSerializer<'a>
pub fn custom_redacted_root_fields( self, fields: &'a [&'a str], ) -> RedactingSerializer<'a>
Add custom fields to redact at the root of the object.
Trait Implementations§
§impl<'a> Clone for RedactingSerializer<'a>
impl<'a> Clone for RedactingSerializer<'a>
§fn clone(&self) -> RedactingSerializer<'a>
fn clone(&self) -> RedactingSerializer<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl<'a> Debug for RedactingSerializer<'a>
impl<'a> Debug for RedactingSerializer<'a>
§impl<'a> Default for RedactingSerializer<'a>
impl<'a> Default for RedactingSerializer<'a>
§fn default() -> RedactingSerializer<'a>
fn default() -> RedactingSerializer<'a>
Returns the “default value” for a type. Read more
impl<'a> Copy for RedactingSerializer<'a>
Auto Trait Implementations§
impl<'a> Freeze for RedactingSerializer<'a>
impl<'a> RefUnwindSafe for RedactingSerializer<'a>
impl<'a> Send for RedactingSerializer<'a>
impl<'a> Sync for RedactingSerializer<'a>
impl<'a> Unpin for RedactingSerializer<'a>
impl<'a> UnsafeUnpin for RedactingSerializer<'a>
impl<'a> UnwindSafe for RedactingSerializer<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<> Read moreSource§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more