Skip to content

Commit bf6e4a8

Browse files
committed
chore(timeline): add an FFI helper to get the debug string of a TimelineUniqueId
1 parent 12a16da commit bf6e4a8

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/matrix-sdk-ui/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ indexmap = "2.0.0"
3737
itertools = { workspace = true }
3838
matrix-sdk = { workspace = true, features = ["experimental-sliding-sync", "e2e-encryption"] }
3939
matrix-sdk-base = { workspace = true }
40+
matrix-sdk-ffi-macros = { workspace = true }
4041
mime = "0.3.16"
4142
once_cell = { workspace = true }
4243
pin-project-lite = { workspace = true }

crates/matrix-sdk-ui/src/timeline/item.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ use super::{EventTimelineItem, VirtualTimelineItem};
2727
#[cfg_attr(feature = "uniffi", derive(uniffi::Object))]
2828
pub struct TimelineUniqueId(pub(crate) String);
2929

30+
#[cfg(all(not(tarpaulin_include), feature = "uniffi"))] // debug-logging functionality
31+
#[matrix_sdk_ffi_macros::export]
32+
impl TimelineUniqueId {
33+
/// Returns a debug string representing the unique id, for debugging
34+
/// purposes.
35+
pub fn debug_string(&self) -> String {
36+
format!("{self:?}")
37+
}
38+
}
39+
3040
impl PartialEq<TimelineUniqueId> for &TimelineUniqueId {
3141
fn eq(&self, other: &TimelineUniqueId) -> bool {
3242
self.0 == other.0

0 commit comments

Comments
 (0)