Adds a single `Event` Rust pyclass that replaces the Python EventBase /
FrozenEventV{1,2,3,4,VMSC4242} hierarchy. The class is added but not yet
wired into Python — callers continue to use the existing Python classes
in this commit; the migration follows in the next commit.
The internals use an `FormattedEvent` over
`EventFormatV{1,2V3,4,VMSC4242}` structs sharing an `EventCommonFields`.
Format-specific behaviour (prev_event_ids, auth_event_ids, room_id
derivation for v12 create events, etc) is encapsulated per variant.
Event IDs are computed in the constructor for v3+ formats; v1/v2 use the
`event_id` field as-is.
Two supporting Rust modules are added at the same time:
- `events::constants` — string constants for event types, top-level
fields, and per-event-type content fields, used to keep the redaction
rules and field accessors readable.
- `events::utils` — `redact()`, `compute_event_reference_hash()`, and
`calculate_event_id()`, ported from `synapse.crypto.event_signing` /
`synapse.events.utils`.
Small prerequisites for porting the Python EventBase hierarchy to Rust:
- duration: make `from_milliseconds` const and add an `IntoPyObject` impl
for owned `SynapseDuration`, so the new Rust `Event.sticky_duration()`
can return one directly to Python.
- internal_metadata: rename `copy()` to `deep_copy()` (matching the new
naming used by the rest of the events module) and make `new()` callable
from sibling modules.
- json_object: expose `object` as a `pub` field and add a `get_field`
helper so the new Event class can read from it without going through
Python.
- signatures, unsigned: add `deep_copy()` methods so the new Event class
can implement its own deep-copy.
This is in prep for using the room versions more from Rust.
Main changes:
- Change it so each room version is defined as a delta to the last one.
This is a cosmetic change that makes it easier to ensure the room
version definitions are correct (as they're defined as deltas from
previous versions).
- Move constants to `RoomVersion` constants, like `RoomVersion::V1`, for
convenience.
- Change visibility of various attributes.