pub struct Video { /* private fields */ }Expand description
Video block representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| alt_text | String | Yes | N/A |
| author_name | String | No | Maximum 50 characters |
| block_id | String | No | Maximum 255 characters |
| description | Text<Plain> | No | Maximum 200 characters |
| provider_icon_url | String | No | N/A |
| provider_name | String | No | N/A |
| title | Text<Plain> | Yes | Maximum 200 characters |
| title_url | String | No | N/A |
| thumbnail_url | String | Yes | N/A |
| video_url | String | Yes | N/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
impl Video
Sourcepub fn builder() -> VideoBuilder
pub fn builder() -> VideoBuilder
constract VideoBuilder object.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)