#[non_exhaustive]pub enum GalleryItemType {
Audio(AudioMessageEventContent),
File(FileMessageEventContent),
Image(ImageMessageEventContent),
Video(VideoMessageEventContent),
}Expand description
The content that is specific to each gallery item type variant.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Audio(AudioMessageEventContent)
An audio item.
File(FileMessageEventContent)
A file item.
Image(ImageMessageEventContent)
An image item.
Video(VideoMessageEventContent)
A video item.
Implementations§
Source§impl GalleryItemType
impl GalleryItemType
Sourcepub fn new(itemtype: &str, body: String, data: JsonObject) -> Result<Self>
pub fn new(itemtype: &str, body: String, data: JsonObject) -> Result<Self>
Creates a new GalleryItemType.
The itemtype and body are required fields.
Additionally it’s possible to add arbitrary key/value pairs to the event content for custom
item types through the data map.
Prefer to use the public variants of GalleryItemType where possible; this constructor is
meant be used for unsupported item types only and does not allow setting arbitrary data
for supported ones.
§Errors
Returns an error if the itemtype is known and serialization of data to the corresponding
GalleryItemType variant fails.
Sourcepub fn data(&self) -> Cow<'_, JsonObject>
pub fn data(&self) -> Cow<'_, JsonObject>
Returns the associated data.
The returned JSON object won’t contain the itemtype and body fields, use
.itemtype() / .body() to access those.
Prefer to use the public variants of GalleryItemType where possible; this method is meant
to be used for custom message types only.
Trait Implementations§
Source§impl Clone for GalleryItemType
impl Clone for GalleryItemType
Source§fn clone(&self) -> GalleryItemType
fn clone(&self) -> GalleryItemType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GalleryItemType
impl Debug for GalleryItemType
Source§impl<'de> Deserialize<'de> for GalleryItemType
Available on crate feature unstable-msc4274 only.
impl<'de> Deserialize<'de> for GalleryItemType
unstable-msc4274 only.