feat(ffi): expose Room.get_state_event(), Room.account_data(), and Room.set_account_data()#6430
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6430 +/- ##
==========================================
+ Coverage 89.82% 89.83% +0.01%
==========================================
Files 378 378
Lines 103931 103931
Branches 103931 103931
==========================================
+ Hits 93351 93367 +16
+ Misses 6995 6982 -13
+ Partials 3585 3582 -3 ☔ View full report in Codecov by Sentry. |
Move `matrix_sdk_base` import to alphabetical position and collapse single-param `account_data` signature to one line per rustfmt. Made-with: Cursor
Merging this PR will degrade performance by 49.63%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | Restore session [memory store] |
112 ms | 222.2 ms | -49.63% |
Comparing lucasfeijo:feat/ffi-room-state-and-account-data (4e78fa7) with main (3d29db5)
|
This looks like a false positive, because the changes don't touch any code paths related to session restore or memory store, the PR only adds account_data(), set_account_data(), and get_state_event() as new methods on Room. No existing code is modified. |
|
It's indeed a false positive, this benchmark unfortunately is bimodal. |
bnjbvr
left a comment
There was a problem hiding this comment.
Thanks, makes sense! Small suggestions below
Made-with: Cursor
| - Expose `Room.account_data()`, `Room.set_account_data()`, and `Room.get_state_event()` | ||
| through FFI bindings, allowing non-Rust clients to read/write room-scoped account data | ||
| and read room state events. |
There was a problem hiding this comment.
Can you apply the renamings here too, add the point about custom events, and include the PR number as done on other lines below?
Expose room-scoped state event reading and account data read/write through the FFI bindings.
Motivation
Non-Rust clients (Swift/iOS, Kotlin/Android) currently have no way to read arbitrary room state events or room-scoped account data through FFI. The underlying SDK already has Room::get_state_event(), Room::account_data(), and Room::set_account_data_raw() — this PR surfaces them.
Room.send_state_event_raw()#6350) with the read sideTested by integrating a build into our iOS application.
CHANGELOG.mdfiles.Signed-off-by: