#[non_exhaustive]pub struct VideoMessageEventContent {
pub body: String,
pub formatted: Option<FormattedBody>,
pub filename: Option<String>,
pub source: MediaSource,
pub info: Option<Box<VideoInfo>>,
}
events
only.Expand description
The payload for a video message.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.body: String
A description of the video.
If the filename
field is not set or has the same value, this is the filename of the
uploaded file. Otherwise, this should be interpreted as a user-written media caption.
formatted: Option<FormattedBody>
Formatted form of the message body
.
This should only be set if the body represents a caption.
filename: Option<String>
The original filename of the uploaded file as deserialized from the event.
It is recommended to use the filename
method to get the filename which automatically
falls back to the body
field when the filename
field is not set.
source: MediaSource
The source of the video clip.
info: Option<Box<VideoInfo>>
Metadata about the video clip referred to in source
.
Implementations§
Source§impl VideoMessageEventContent
impl VideoMessageEventContent
Sourcepub fn new(body: String, source: MediaSource) -> VideoMessageEventContent
pub fn new(body: String, source: MediaSource) -> VideoMessageEventContent
Creates a new VideoMessageEventContent
with the given body and source.
Sourcepub fn plain(body: String, url: OwnedMxcUri) -> VideoMessageEventContent
pub fn plain(body: String, url: OwnedMxcUri) -> VideoMessageEventContent
Creates a new non-encrypted VideoMessageEventContent
with the given body and url.
Sourcepub fn encrypted(body: String, file: EncryptedFile) -> VideoMessageEventContent
pub fn encrypted(body: String, file: EncryptedFile) -> VideoMessageEventContent
Creates a new encrypted VideoMessageEventContent
with the given body and encrypted
file.
Sourcepub fn info(
self,
info: impl Into<Option<Box<VideoInfo>>>,
) -> VideoMessageEventContent
pub fn info( self, info: impl Into<Option<Box<VideoInfo>>>, ) -> VideoMessageEventContent
Creates a new VideoMessageEventContent
from self
with the info
field set to the given
value.
Since the field is public, you can also assign to it directly. This method merely acts as a shorthand for that, because it is very common to set this field.
Sourcepub fn filename(&self) -> &str
pub fn filename(&self) -> &str
Computes the filename of the video as defined by the spec.
This differs from the filename
field as this method falls back to the body
field when
the filename
field is not set.
Returns the caption of the video as defined by the spec.
In short, this is the body
field if the filename
field exists and has a different value,
otherwise the media file does not have a caption.
Returns the formatted caption of the video as defined by the spec.
This is the same as caption
, but returns the formatted body instead of the plain body.
Trait Implementations§
Source§impl Clone for VideoMessageEventContent
impl Clone for VideoMessageEventContent
Source§fn clone(&self) -> VideoMessageEventContent
fn clone(&self) -> VideoMessageEventContent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more