pub trait Redactable {
// Required method
fn redact(
&mut self,
redactor: &UserId,
reason: Option<String>,
) -> Result<(), ValidationError>;
}Expand description
Trait for events that can be redacted in-place.
This trait provides redaction functionality for signed and verified events.
§Usage
ⓘ
use arminius_lib_events::Redactable;
// Redact a signed event
signed_event.redact(&redactor_user_id, Some("spam".to_owned()))?;
// Redact a verified event
verified_event.redact(&redactor_user_id, None)?;§Redacted Content
After redaction, the event content is modified to retain only the fields allowed by the Matrix specification for the event’s room version. The event ID and signatures remain unchanged.
Required Methods§
Sourcefn redact(
&mut self,
redactor: &UserId,
reason: Option<String>,
) -> Result<(), ValidationError>
fn redact( &mut self, redactor: &UserId, reason: Option<String>, ) -> Result<(), ValidationError>
Redact this event in-place.
This method modifies the event content according to Matrix redaction rules while preserving the event ID and signatures.
§Parameters
redactor: User ID of the user performing the redaction.reason: Optional reason for the redaction.
§Errors
Returns ValidationError if:
- Event content cannot be parsed as JSON
- Canonical JSON generation fails
- Redaction fails due to invalid event structure
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".