Struct ruma_events::room::message::FileMessageEventContent
source · pub struct FileMessageEventContent {
pub body: String,
pub formatted: Option<FormattedBody>,
pub filename: Option<String>,
pub source: MediaSource,
pub info: Option<Box<FileInfo>>,
}
Expand description
The payload for a file message.
Fields§
§body: String
A human-readable description of the file.
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.
source: MediaSource
The source of the file.
info: Option<Box<FileInfo>>
Metadata about the file referred to in source
.
Implementations§
source§impl FileMessageEventContent
impl FileMessageEventContent
sourcepub fn new(body: String, source: MediaSource) -> Self
pub fn new(body: String, source: MediaSource) -> Self
Creates a new FileMessageEventContent
with the given body and source.
sourcepub fn plain(body: String, url: OwnedMxcUri) -> Self
pub fn plain(body: String, url: OwnedMxcUri) -> Self
Creates a new non-encrypted FileMessageEventContent
with the given body and url.
sourcepub fn encrypted(body: String, file: EncryptedFile) -> Self
pub fn encrypted(body: String, file: EncryptedFile) -> Self
Creates a new encrypted FileMessageEventContent
with the given body and encrypted
file.
sourcepub fn info(self, info: impl Into<Option<Box<FileInfo>>>) -> Self
pub fn info(self, info: impl Into<Option<Box<FileInfo>>>) -> Self
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§
source§impl Clone for FileMessageEventContent
impl Clone for FileMessageEventContent
source§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 moresource§impl Debug for FileMessageEventContent
impl Debug for FileMessageEventContent
source§impl<'de> Deserialize<'de> for FileMessageEventContent
impl<'de> Deserialize<'de> for FileMessageEventContent
source§fn 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>,
Auto Trait Implementations§
impl Freeze for FileMessageEventContent
impl RefUnwindSafe for FileMessageEventContent
impl Send for FileMessageEventContent
impl Sync for FileMessageEventContent
impl Unpin for FileMessageEventContent
impl UnwindSafe for FileMessageEventContent
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)