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§
Source§impl<'a> RedactingSerializer<'a>
impl<'a> RedactingSerializer<'a>
Sourcepub fn new() -> RedactingSerializer<'a>
pub fn new() -> RedactingSerializer<'a>
Construct a new RedactingSerializer that doesn’t redact anything.
Sourcepub 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.
Sourcepub 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§
Source§impl<'a> Clone for RedactingSerializer<'a>
impl<'a> Clone for RedactingSerializer<'a>
Source§fn clone(&self) -> RedactingSerializer<'a>
fn clone(&self) -> RedactingSerializer<'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 RedactingSerializer<'a>
Source§impl<'a> Debug for RedactingSerializer<'a>
impl<'a> Debug for RedactingSerializer<'a>
Source§impl<'a> Default for RedactingSerializer<'a>
impl<'a> Default for RedactingSerializer<'a>
Source§fn default() -> RedactingSerializer<'a>
fn default() -> RedactingSerializer<'a>
Returns the “default value” for a type. Read more
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,
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
impl<T> ErasedDestructor for Twhere
T: 'static,
§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 more