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
sourceimpl Image
impl Image
sourcepub fn url(&self) -> &str
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");
sourcepub fn set_url<V>(&mut self, url: V) where
V: Into<String>,
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");
sourcepub fn title(&self) -> &str
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");
sourcepub fn set_title<V>(&mut self, title: V) where
V: Into<String>,
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");
sourcepub fn link(&self) -> &str
pub fn link(&self) -> &str
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");
sourcepub fn set_link<V>(&mut self, link: V) where
V: Into<String>,
pub fn set_link<V>(&mut self, link: V) where
V: Into<String>,
Set the URL that this image links to.
Examples
use rss::Image;
let mut image = Image::default();
image.set_link("http://example.com");
sourcepub fn width(&self) -> Option<&str>
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"));
sourcepub fn set_width<V>(&mut self, width: V) where
V: Into<Option<String>>,
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());
sourcepub fn height(&self) -> Option<&str>
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"));
sourcepub fn set_height<V>(&mut self, height: V) where
V: Into<Option<String>>,
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());
sourcepub fn description(&self) -> Option<&str>
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"));
Trait Implementations
impl StructuralPartialEq for Image
Auto Trait Implementations
impl RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnwindSafe for Image
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more