Struct ruma_events::room::message::UrlPreview
source · pub struct UrlPreview {
pub matched_url: Option<String>,
pub url: Option<String>,
pub title: Option<String>,
pub description: Option<String>,
pub image: Option<PreviewImage>,
}
Expand description
Preview Information for a URL matched in the message’s text, according to MSC 4095.
Fields§
§matched_url: Option<String>
The url this was matching on.
url: Option<String>
Canonical URL according to open graph data.
title: Option<String>
Title to use for the preview.
description: Option<String>
Description to use for the preview.
image: Option<PreviewImage>
Metadata of a preview image if given.
Implementations§
source§impl UrlPreview
impl UrlPreview
sourcepub fn matched_url(matched_url: String) -> Self
pub fn matched_url(matched_url: String) -> Self
Construct an preview for a matched_url.
sourcepub fn canonical_url(url: String) -> Self
pub fn canonical_url(url: String) -> Self
Construct an preview for a canonical url.
sourcepub fn contains_preview(&self) -> bool
pub fn contains_preview(&self) -> bool
Whether this preview contains an actual preview or the users homeserver should be asked for preview data instead.
Trait Implementations§
source§impl Clone for UrlPreview
impl Clone for UrlPreview
source§fn clone(&self) -> UrlPreview
fn clone(&self) -> UrlPreview
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for UrlPreview
impl Debug for UrlPreview
source§impl<'de> Deserialize<'de> for UrlPreview
impl<'de> Deserialize<'de> for UrlPreview
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for UrlPreview
impl RefUnwindSafe for UrlPreview
impl Send for UrlPreview
impl Sync for UrlPreview
impl Unpin for UrlPreview
impl UnwindSafe for UrlPreview
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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)