Skip to content

Commit adb7cd3

Browse files
Hywanstefanceriu
authored andcommitted
task(base): Introduce UpdatedRoomDisplayName.
This patch introduces a new enum: `UpdatedRoomDisplayName`, which will be used to know if a room display name is different or not when computing the room display name.
1 parent bc50cae commit adb7cd3

File tree

1 file changed

+17
-0
lines changed
  • crates/matrix-sdk-base/src/rooms

1 file changed

+17
-0
lines changed

crates/matrix-sdk-base/src/rooms/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,23 @@ pub enum RoomDisplayName {
6666
Empty,
6767
}
6868

69+
/// An internal representing whether a room display name is new or not when
70+
/// computed.
71+
pub(crate) enum UpdatedRoomDisplayName {
72+
New(RoomDisplayName),
73+
Same(RoomDisplayName),
74+
}
75+
76+
impl UpdatedRoomDisplayName {
77+
/// Get the inner [`RoomDisplayName`].
78+
pub fn into_inner(self) -> RoomDisplayName {
79+
match self {
80+
UpdatedRoomDisplayName::New(room_display_name) => room_display_name,
81+
UpdatedRoomDisplayName::Same(room_display_name) => room_display_name,
82+
}
83+
}
84+
}
85+
6986
const WHITESPACE_REGEX: &str = r"\s+";
7087
const INVALID_SYMBOLS_REGEX: &str = r"[#,:\{\}\\]+";
7188

0 commit comments

Comments
 (0)