Summary

Struct Summary 

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

Create a summary card.

Implementations§

Source§

impl Summary

Source

pub fn builder() -> Self

Create a new instance.

Examples found in repository?
examples/example.rs (line 6)
5fn main() {
6  let card = Summary::builder()
7    .site("@flickr")
8    .title("Small Island Developing States Photo Submission")
9    .desc("View the album on Flickr.")
10    .image("https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg")
11    .build();
12
13  println!("{}", card);
14}
Source

pub fn site(self, site: &str) -> Self

@username of website. Either twitter:site or twitter:site:id is required.

Examples found in repository?
examples/example.rs (line 7)
5fn main() {
6  let card = Summary::builder()
7    .site("@flickr")
8    .title("Small Island Developing States Photo Submission")
9    .desc("View the album on Flickr.")
10    .image("https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg")
11    .build();
12
13  println!("{}", card);
14}
Source

pub fn site_id(self, content: &str) -> Self

Same as twitter:site, but the user’s Twitter ID. Either twitter:site or twitter:site:id is required.

Source

pub fn creator_id(self, content: &str) -> Self

Twitter user ID of content creator.

Source

pub fn desc(self, content: &str) -> Self

Description of content.

§Panics.

Panics if the description is more than 200 characters.

Examples found in repository?
examples/example.rs (line 9)
5fn main() {
6  let card = Summary::builder()
7    .site("@flickr")
8    .title("Small Island Developing States Photo Submission")
9    .desc("View the album on Flickr.")
10    .image("https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg")
11    .build();
12
13  println!("{}", card);
14}
Source

pub fn title(self, content: &str) -> Self

Title of content.

§Panics.

Panics if the description is more than 70 characters.

Examples found in repository?
examples/example.rs (line 8)
5fn main() {
6  let card = Summary::builder()
7    .site("@flickr")
8    .title("Small Island Developing States Photo Submission")
9    .desc("View the album on Flickr.")
10    .image("https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg")
11    .build();
12
13  println!("{}", card);
14}
Source

pub fn image(self, content: &str) -> Self

URL of image to use in the card. Images must be less than 5MB in size. JPG, PNG, WEBP and GIF formats are supported. Only the first frame of an animated GIF will be used. SVG is not supported.

Examples found in repository?
examples/example.rs (line 10)
5fn main() {
6  let card = Summary::builder()
7    .site("@flickr")
8    .title("Small Island Developing States Photo Submission")
9    .desc("View the album on Flickr.")
10    .image("https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg")
11    .build();
12
13  println!("{}", card);
14}
Source

pub fn image_alt(self, content: &str) -> Self

A text description of the image conveying the essential nature of an image to users who are visually impaired. Maximum 420 characters.

§Panics.

Panics if the description is more than 420 characters.

Trait Implementations§

Source§

impl Clone for Summary

Source§

fn clone(&self) -> Summary

Returns a duplicate 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 Summary

Source§

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

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

impl TwitterCard for Summary

Source§

fn build(self) -> String

Convert the Twitter Card to a string.

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> CloneToUninit for T
where T: Clone,

Source§

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

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>,

Source§

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>,

Source§

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.