pub struct Enclosure {
pub url: String,
pub length: String,
pub mime_type: String,
}
Expand description
Represents an enclosure in an RSS item.
Fields§
§url: String
The URL of the enclosure.
length: String
The length of the enclosure in bytes.
mime_type: String
The MIME type of the enclosure.
Implementations§
source§impl Enclosure
impl Enclosure
sourcepub fn url(&self) -> &str
pub fn url(&self) -> &str
Return the URL of this enclosure.
Examples
use rss::Enclosure;
let mut enclosure = Enclosure::default();
enclosure.set_url("http://example.com/audio.mp3");
assert_eq!(enclosure.url(), "http://example.com/audio.mp3");
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 enclosure.
Examples
use rss::Enclosure;
let mut enclosure = Enclosure::default();
enclosure.set_url("http://example.com/audio.mp3");
sourcepub fn length(&self) -> &str
pub fn length(&self) -> &str
Return the content length of this enclosure.
Examples
use rss::Enclosure;
let mut enclosure = Enclosure::default();
enclosure.set_length("1000");
assert_eq!(enclosure.length(), "1000");
sourcepub fn set_length<V>(&mut self, length: V)where
V: Into<String>,
pub fn set_length<V>(&mut self, length: V)where V: Into<String>,
Set the content length of this enclosure.
Examples
use rss::Enclosure;
let mut enclosure = Enclosure::default();
enclosure.set_length("1000");
sourcepub fn mime_type(&self) -> &str
pub fn mime_type(&self) -> &str
Return the MIME type of this enclosure.
Examples
use rss::Enclosure;
let mut enclosure = Enclosure::default();
enclosure.set_mime_type("audio/mpeg");
assert_eq!(enclosure.mime_type(), "audio/mpeg");
sourcepub fn set_mime_type<V>(&mut self, mime_type: V)where
V: Into<String>,
pub fn set_mime_type<V>(&mut self, mime_type: V)where V: Into<String>,
Set the MIME type of this enclosure.
Examples
use rss::Enclosure;
let mut enclosure = Enclosure::default();
enclosure.set_mime_type("audio/mpeg");
Trait Implementations§
source§impl<'de> Deserialize<'de> for Enclosure
impl<'de> Deserialize<'de> for Enclosure
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Enclosure
impl PartialEq for Enclosure
impl StructuralPartialEq for Enclosure
Auto Trait Implementations§
impl RefUnwindSafe for Enclosure
impl Send for Enclosure
impl Sync for Enclosure
impl Unpin for Enclosure
impl UnwindSafe for Enclosure
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more