rss

Struct Image

Source
pub struct Image {
    pub url: String,
    pub title: String,
    pub link: String,
    pub width: Option<String>,
    pub height: Option<String>,
    pub description: Option<String>,
}
Expand description

Represents an image in an RSS feed.

Fields§

§url: String

The URL of the image.

§title: String

A description of the image. This is used in the HTML alt attribute.

§link: String

The URL that the image links to.

§width: Option<String>

The width of the image.

§height: Option<String>

The height of the image.

§description: Option<String>

The text for the HTML title attribute of the link formed around the image.

Implementations§

Source§

impl Image

Source

pub fn url(&self) -> &str

Return the URL of this image.

§Examples
use rss::Image;

let mut image = Image::default();
image.set_url("http://example.com/image.png");
assert_eq!(image.url(), "http://example.com/image.png");
Source

pub fn set_url<V>(&mut self, url: V)
where V: Into<String>,

Set the URL of this image.

§Examples
use rss::Image;

let mut image = Image::default();
image.set_url("http://example.com/image.png");
Source

pub fn title(&self) -> &str

Return the description of this image.

This is used in the HTML alt attribute.

§Examples
use rss::Image;

let mut image = Image::default();
image.set_title("Example image");
assert_eq!(image.title(), "Example image");
Source

pub fn set_title<V>(&mut self, title: V)
where V: Into<String>,

Set the description of this image.

This is used in the HTML alt attribute.

§Examples
use rss::Image;

let mut image = Image::default();
image.set_title("Example image");

Return the URL that this image links to.

§Examples
use rss::Image;

let mut image = Image::default();
image.set_link("http://example.com");
assert_eq!(image.link(), "http://example.com");

Set the URL that this image links to.

§Examples
use rss::Image;

let mut image = Image::default();
image.set_link("http://example.com");
Source

pub fn width(&self) -> Option<&str>

Return the width of this image.

If the width is None the default value should be considered to be 80.

§Examples
use rss::Image;

let mut image = Image::default();
image.set_width("80".to_string());
assert_eq!(image.width(), Some("80"));
Source

pub fn set_width<V>(&mut self, width: V)
where V: Into<Option<String>>,

Set the width of this image.

§Examples
use rss::Image;

let mut image = Image::default();
image.set_width("80".to_string());
Source

pub fn height(&self) -> Option<&str>

Return the height of this image.

If the height is None the default value should be considered to be 31.

§Examples
use rss::Image;

let mut image = Image::default();
image.set_height("31".to_string());
assert_eq!(image.height(), Some("31"));
Source

pub fn set_height<V>(&mut self, height: V)
where V: Into<Option<String>>,

Set the height of this image.

If the height is None the default value should be considered to be 31.

§Examples
use rss::Image;

let mut image = Image::default();
image.set_height("31".to_string());
Source

pub fn description(&self) -> Option<&str>

Return the title for the link formed around this image.

§Examples
use rss::Image;

let mut image = Image::default();
image.set_description("Example Title".to_string());
assert_eq!(image.description(), Some("Example Title"));
Source

pub fn set_description<V>(&mut self, description: V)
where V: Into<Option<String>>,

Set the title for the link formed around this image.

§Examples
use rss::Image;

let mut image = Image::default();
image.set_description("Example Title".to_string());
Source§

impl Image

Source

pub fn from_xml<R: BufRead>( reader: &mut Reader<R>, _: Attributes<'_>, ) -> Result<Self, Error>

Builds an Image from source XML

Trait Implementations§

Source§

impl Clone for Image

Source§

fn clone(&self) -> Image

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 Image

Source§

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

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

impl Default for Image

Source§

fn default() -> Image

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

impl PartialEq for Image

Source§

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

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

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 StructuralPartialEq for Image

Auto Trait Implementations§

§

impl Freeze for Image

§

impl RefUnwindSafe for Image

§

impl Send for Image

§

impl Sync for Image

§

impl Unpin for Image

§

impl UnwindSafe for Image

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.