Skip to content

Commit ace8447

Browse files
authored
Tidy up Rust RoomVersion structs (#19766)
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.
1 parent b90a0e9 commit ace8447

3 files changed

Lines changed: 257 additions & 507 deletions

File tree

changelog.d/19766.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Tidy up Rust `RoomVersion` structs.

rust/src/events/json_object.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use serde::{Deserialize, Serialize};
3434
/// 1. Fast access of top-level keys (e.g. `event.content["key"]`)
3535
/// 2. Pure Rust implementation.
3636
#[derive(Serialize, Deserialize, Clone, Default)]
37-
#[pyclass(mapping, frozen)]
37+
#[pyclass(mapping, frozen, skip_from_py_object)]
3838
#[serde(transparent)]
3939
pub struct JsonObject {
4040
object: Arc<BTreeMap<Box<str>, serde_json::Value>>,
@@ -197,7 +197,7 @@ impl JsonObject {
197197
/// of the object.
198198
///
199199
/// This needs to both be iterable *and* operate like a set.
200-
#[pyclass(frozen)]
200+
#[pyclass(frozen, skip_from_py_object)]
201201
#[derive(Clone)]
202202
pub struct JsonObjectKeysView {
203203
object: JsonObject,
@@ -397,7 +397,7 @@ impl JsonObjectKeysView {
397397

398398
/// Helper class returned by `JsonObject.values()` to act as a view into the
399399
/// values of the object.
400-
#[pyclass(frozen)]
400+
#[pyclass(frozen, skip_from_py_object)]
401401
#[derive(Clone)]
402402
pub struct JsonObjectValuesView {
403403
object: JsonObject,
@@ -440,7 +440,7 @@ impl JsonObjectValuesView {
440440
/// unless the values are unhashable. Since the values are immutable we could
441441
/// support it, but it's more work and nobody seems to actually use the set
442442
/// operations on `dict_items` in practice.
443-
#[pyclass(frozen)]
443+
#[pyclass(frozen, skip_from_py_object)]
444444
#[derive(Clone)]
445445
pub struct JsonObjectItemsView {
446446
object: JsonObject,

0 commit comments

Comments
 (0)