Video

Struct Video 

Source
pub struct Video { /* private fields */ }
Expand description

Video block representation.

§Fields and Validations

For more details, see the official documentation.

FieldTypeRequiredValidation
alt_textStringYesN/A
author_nameStringNoMaximum 50 characters
block_idStringNoMaximum 255 characters
descriptionText<Plain>NoMaximum 200 characters
provider_icon_urlStringNoN/A
provider_nameStringNoN/A
titleText<Plain>YesMaximum 200 characters
title_urlStringNoN/A
thumbnail_urlStringYesN/A
video_urlStringYesN/A

§Example

use slack_messaging::plain_text;
use slack_messaging::blocks::Video;

let video = Video::builder()
    .title(plain_text!("How to use Slack.")?)
    .description(plain_text!("Slack is a new way to communicate with your team. It's faster, better organized and more secure than email.")?)
    .title_url("https://www.youtube.com/watch?v=RRxQQxiM7AA")
    .video_url("https://www.youtube.com/embed/RRxQQxiM7AA?feature=oembed&autoplay=1")
    .thumbnail_url("https://i.ytimg.com/vi/RRxQQxiM7AA/hqdefault.jpg")
    .alt_text("How to use Slack?")
    .author_name("Arcado Buendia")
    .provider_name("YouTube")
    .provider_icon_url("https://a.slack-edge.com/80588/img/unfurl_icons/youtube.png")
    .build()?;

let expected = serde_json::json!({
    "type": "video",
    "title": {
        "type": "plain_text",
        "text": "How to use Slack."
    },
    "description": {
        "type": "plain_text",
        "text": "Slack is a new way to communicate with your team. It's faster, better organized and more secure than email."
    },
    "title_url": "https://www.youtube.com/watch?v=RRxQQxiM7AA",
    "video_url": "https://www.youtube.com/embed/RRxQQxiM7AA?feature=oembed&autoplay=1",
    "thumbnail_url": "https://i.ytimg.com/vi/RRxQQxiM7AA/hqdefault.jpg",
    "alt_text": "How to use Slack?",
    "author_name": "Arcado Buendia",
    "provider_name": "YouTube",
    "provider_icon_url": "https://a.slack-edge.com/80588/img/unfurl_icons/youtube.png"
});

let json = serde_json::to_value(video).unwrap();

assert_eq!(json, expected);

Implementations§

Source§

impl Video

Source

pub fn builder() -> VideoBuilder

constract VideoBuilder object.

Trait Implementations§

Source§

impl Clone for Video

Source§

fn clone(&self) -> Video

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Video

Source§

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

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

impl From<Video> for Block

Source§

fn from(value: Video) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Video

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Video

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 Video

Auto Trait Implementations§

§

impl Freeze for Video

§

impl RefUnwindSafe for Video

§

impl Send for Video

§

impl Sync for Video

§

impl Unpin for Video

§

impl UnwindSafe for Video

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

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

Performs the conversion.