Struct matrix_sdk_base::ruma::events::room::message::FileMessageEventContent
#[non_exhaustive]pub struct FileMessageEventContent {
pub body: String,
pub filename: Option<String>,
pub source: MediaSource,
pub info: Option<Box<FileInfo>>,
}
Expand description
The payload for a file 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 human-readable description of the file.
This is recommended to be the filename of the original upload.
filename: Option<String>
The original filename of the uploaded file.
source: MediaSource
The source of the file.
info: Option<Box<FileInfo>>
Metadata about the file referred to in source
.
Implementations§
§impl FileMessageEventContent
impl FileMessageEventContent
pub fn new(body: String, source: MediaSource) -> FileMessageEventContent
pub fn new(body: String, source: MediaSource) -> FileMessageEventContent
Creates a new FileMessageEventContent
with the given body and source.
pub fn plain(body: String, url: OwnedMxcUri) -> FileMessageEventContent
pub fn plain(body: String, url: OwnedMxcUri) -> FileMessageEventContent
Creates a new non-encrypted FileMessageEventContent
with the given body and url.
pub fn encrypted(body: String, file: EncryptedFile) -> FileMessageEventContent
pub fn encrypted(body: String, file: EncryptedFile) -> FileMessageEventContent
Creates a new encrypted FileMessageEventContent
with the given body and encrypted
file.
pub fn filename(
self,
filename: impl Into<Option<String>>
) -> FileMessageEventContent
pub fn filename( self, filename: impl Into<Option<String>> ) -> FileMessageEventContent
Creates a new FileMessageEventContent
from self
with the filename
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.
pub fn info(
self,
info: impl Into<Option<Box<FileInfo>>>
) -> FileMessageEventContent
pub fn info( self, info: impl Into<Option<Box<FileInfo>>> ) -> FileMessageEventContent
Creates a new FileMessageEventContent
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.
Trait Implementations§
§impl Clone for FileMessageEventContent
impl Clone for FileMessageEventContent
§fn clone(&self) -> FileMessageEventContent
fn clone(&self) -> FileMessageEventContent
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for FileMessageEventContent
impl Debug for FileMessageEventContent
§impl<'de> Deserialize<'de> for FileMessageEventContent
impl<'de> Deserialize<'de> for FileMessageEventContent
§fn deserialize<__D>(
__deserializer: __D
) -> Result<FileMessageEventContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<FileMessageEventContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl MediaEventContent for FileMessageEventContent
impl MediaEventContent for FileMessageEventContent
source§fn thumbnail_source(&self) -> Option<MediaSource>
fn thumbnail_source(&self) -> Option<MediaSource>
Self
. Read more