Struct ruma_common::events::voice::VoiceEventContent
source · [−]pub struct VoiceEventContent {
pub message: MessageContent,
pub file: FileContent,
pub audio: AudioContent,
pub voice: VoiceContent,
pub relates_to: Option<Relation>,
}
events
and unstable-msc3245
only.Expand description
The payload for an extensible voice message.
This is the new primary type introduced in MSC3245 and should not be sent before the end of
the transition period. See the documentation of the message
module for more information.
VoiceEventContent
can be converted to a RoomMessageEventContent
with a
MessageType::Audio
with the m.voice
flag. You can convert it back with
VoiceEventContent::try_from_audio_room_message()
.
Fields
message: MessageContent
The text representation of the message.
file: FileContent
The file content of the message.
audio: AudioContent
The audio content of the message.
voice: VoiceContent
The voice content of the message.
relates_to: Option<Relation>
Information about related messages.
Implementations
sourceimpl VoiceEventContent
impl VoiceEventContent
sourcepub fn plain(message: impl Into<String>, file: FileContent) -> Self
pub fn plain(message: impl Into<String>, file: FileContent) -> Self
Creates a new VoiceEventContent
with the given plain text representation and file.
sourcepub fn with_message(message: MessageContent, file: FileContent) -> Self
pub fn with_message(message: MessageContent, file: FileContent) -> Self
Creates a new VoiceEventContent
with the given message and file.
sourcepub fn try_from_audio_room_message(
content: AudioMessageEventContent,
relates_to: Option<Relation>
) -> Result<Self, TryFromExtensibleError>
pub fn try_from_audio_room_message(
content: AudioMessageEventContent,
relates_to: Option<Relation>
) -> Result<Self, TryFromExtensibleError>
Create a new VoiceEventContent
from the given AudioMessageEventContent
and optional
relation.
This can fail if the AudioMessageEventContent
is not a voice message.
Trait Implementations
sourceimpl Clone for VoiceEventContent
impl Clone for VoiceEventContent
sourcefn clone(&self) -> VoiceEventContent
fn clone(&self) -> VoiceEventContent
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for VoiceEventContent
impl Debug for VoiceEventContent
sourceimpl<'de> Deserialize<'de> for VoiceEventContent
impl<'de> Deserialize<'de> for VoiceEventContent
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
sourceimpl EventContent for VoiceEventContent
impl EventContent for VoiceEventContent
type EventType = MessageLikeEventType
type EventType = MessageLikeEventType
sourcefn event_type(&self) -> Self::EventType
fn event_type(&self) -> Self::EventType
m.room.message
.sourceimpl From<VoiceEventContent> for AnyMessageLikeEventContent
impl From<VoiceEventContent> for AnyMessageLikeEventContent
sourcefn from(c: VoiceEventContent) -> Self
fn from(c: VoiceEventContent) -> Self
sourceimpl From<VoiceEventContent> for RoomMessageEventContent
impl From<VoiceEventContent> for RoomMessageEventContent
sourcefn from(content: VoiceEventContent) -> Self
fn from(content: VoiceEventContent) -> Self
sourceimpl RedactContent for VoiceEventContent
impl RedactContent for VoiceEventContent
type Redacted = RedactedVoiceEventContent
type Redacted = RedactedVoiceEventContent
sourcefn redact(self, version: &RoomVersionId) -> RedactedVoiceEventContent
fn redact(self, version: &RoomVersionId) -> RedactedVoiceEventContent
self
into a redacted form (removing most or all fields) according to the spec. Read more