#[non_exhaustive]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 (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.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