pub struct UrlPreview {
pub matched_url: Option<String>,
pub url: Option<String>,
pub title: Option<String>,
pub description: Option<String>,
pub image: Option<PreviewImage>,
}
Available on crate feature
events
only.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) -> UrlPreview
pub fn matched_url(matched_url: String) -> UrlPreview
Construct an preview for a matched_url.
sourcepub fn canonical_url(url: String) -> UrlPreview
pub fn canonical_url(url: String) -> UrlPreview
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<UrlPreview, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<UrlPreview, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Serialize for UrlPreview
impl Serialize for UrlPreview
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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
)source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more