Struct tgbot::types::LinkPreviewOptions

source ·
pub struct LinkPreviewOptions {
    pub is_disabled: Option<bool>,
    pub prefer_large_media: Option<bool>,
    pub prefer_small_media: Option<bool>,
    pub show_above_text: Option<bool>,
    pub url: Option<String>,
}
Expand description

Represents the options used for link preview generation.

Fields§

§is_disabled: Option<bool>

Whether the link preview is disabled.

§prefer_large_media: Option<bool>

Whether the media in the link preview is suppposed to be enlarged.

§prefer_small_media: Option<bool>

Whether the media in the link preview is suppposed to be shrunk.

§show_above_text: Option<bool>

Whether the link preview must be shown above the message text.

§url: Option<String>

URL to use for the link preview.

Implementations§

source§

impl LinkPreviewOptions

source

pub fn with_is_disabled(self, value: bool) -> Self

Sets a new value for an is_disabled flag.

§Arguments
  • value - Whether the link preview is disabled.
source

pub fn with_prefer_large_media(self, value: bool) -> Self

Sets a new value for a prefer_large_media flag.

§Arguments
  • value - Whether the media in the link preview is suppposed to be enlarged; ignored if the URL isn’t explicitly specified or media size change isn’t supported for the preview.
source

pub fn with_prefer_small_media(self, value: bool) -> Self

Sets a new value for a prefer_small_media flag.

§Arguments
  • value - Whether the media in the link preview is suppposed to be shrunk; ignored if the URL isn’t explicitly specified or media size change isn’t supported for the preview.
source

pub fn with_show_above_text(self, value: bool) -> Self

Sets a new value for a show_above_text flag.

§Arguments
  • value - Whether the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text.
source

pub fn with_url<T>(self, value: T) -> Self
where T: Into<String>,

Sets a new URL.

§Arguments
  • value - URL to use for the link preview.

If empty, then the first URL found in the message text will be used.

Trait Implementations§

source§

impl Clone for LinkPreviewOptions

source§

fn clone(&self) -> LinkPreviewOptions

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for LinkPreviewOptions

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for LinkPreviewOptions

source§

fn default() -> LinkPreviewOptions

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for LinkPreviewOptions

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for LinkPreviewOptions

source§

fn eq(&self, other: &LinkPreviewOptions) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for LinkPreviewOptions

source§

fn partial_cmp(&self, other: &LinkPreviewOptions) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for LinkPreviewOptions

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for LinkPreviewOptions

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromRef<T> for T
where T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,