matrix_sdk_ui/timeline/event_item/content/
other.rs

1// Copyright 2025 The Matrix.org Foundation C.I.C.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Timeline item content for other message-like events created by the
16//! EventContent macro from ruma.
17
18use ruma::events::MessageLikeEventType;
19
20/// A custom event created by the EventContent macro from ruma.
21#[derive(Debug, Clone, PartialEq)]
22pub struct OtherMessageLike {
23    pub(in crate::timeline) event_type: MessageLikeEventType,
24}
25
26impl OtherMessageLike {
27    pub fn from_event_type(event_type: MessageLikeEventType) -> Self {
28        Self { event_type }
29    }
30
31    /// Get the event_type of this message.
32    pub fn event_type(&self) -> &MessageLikeEventType {
33        &self.event_type
34    }
35}