Skip to content

Commit

Permalink
chore(timeline): add an FFI helper to get the debug string of a `Time…
Browse files Browse the repository at this point in the history
…lineUniqueId`
  • Loading branch information
bnjbvr committed Oct 9, 2024
1 parent 12a16da commit bf6e4a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/matrix-sdk-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ indexmap = "2.0.0"
itertools = { workspace = true }
matrix-sdk = { workspace = true, features = ["experimental-sliding-sync", "e2e-encryption"] }
matrix-sdk-base = { workspace = true }
matrix-sdk-ffi-macros = { workspace = true }
mime = "0.3.16"
once_cell = { workspace = true }
pin-project-lite = { workspace = true }
Expand Down
10 changes: 10 additions & 0 deletions crates/matrix-sdk-ui/src/timeline/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ use super::{EventTimelineItem, VirtualTimelineItem};
#[cfg_attr(feature = "uniffi", derive(uniffi::Object))]
pub struct TimelineUniqueId(pub(crate) String);

#[cfg(all(not(tarpaulin_include), feature = "uniffi"))] // debug-logging functionality
#[matrix_sdk_ffi_macros::export]
impl TimelineUniqueId {
/// Returns a debug string representing the unique id, for debugging
/// purposes.
pub fn debug_string(&self) -> String {
format!("{self:?}")
}
}

impl PartialEq<TimelineUniqueId> for &TimelineUniqueId {
fn eq(&self, other: &TimelineUniqueId) -> bool {
self.0 == other.0
Expand Down

0 comments on commit bf6e4a8

Please sign in to comment.