Struct atom_syndication::Content
source · pub struct Content {
pub base: Option<String>,
pub lang: Option<String>,
pub value: Option<String>,
pub src: Option<String>,
pub content_type: Option<String>,
}
Expand description
Represents the content of an Atom entry
Fields§
§base: Option<String>
Base URL for resolving any relative references found in the element.
lang: Option<String>
Indicates the natural language for the element.
value: Option<String>
The text value of the content.
src: Option<String>
The URI of where the content can be found.
content_type: Option<String>
Either “text”, “html”, “xhtml”, or the MIME type of the content.
Implementations§
source§impl Content
impl Content
sourcepub fn value(&self) -> Option<&str>
pub fn value(&self) -> Option<&str>
Return the text value of the content.
If the content_type
is neither "text"
, "html"
, or "xhtml"
then the value should
be a base64 encoded document of the indicated MIME type.
§Examples
use atom_syndication::Content;
let mut content = Content::default();
content.set_value("Example content".to_string());
assert_eq!(content.value(), Some("Example content"));
sourcepub fn set_value<V>(&mut self, value: V)
pub fn set_value<V>(&mut self, value: V)
Set the text value of the content.
§Examples
use atom_syndication::Content;
let mut content = Content::default();
content.set_value("Example content".to_string());
sourcepub fn src(&self) -> Option<&str>
pub fn src(&self) -> Option<&str>
Return the URI where the content can be found.
§Examples
use atom_syndication::Content;
let mut content = Content::default();
content.set_src("http://example.com/content.html".to_string());
assert_eq!(content.src(), Some("http://example.com/content.html"));
sourcepub fn set_src<V>(&mut self, src: V)
pub fn set_src<V>(&mut self, src: V)
Set the URI where the content can be found.
§Examples
use atom_syndication::Content;
let mut content = Content::default();
content.set_src("http://example.com/content.html".to_string());
sourcepub fn content_type(&self) -> Option<&str>
pub fn content_type(&self) -> Option<&str>
Return the type of the content.
The type is either "text"
, "html"
, "xhtml"
, or the MIME type of the content.
§Examples
use atom_syndication::Content;
let mut content = Content::default();
content.set_content_type("image/png".to_string());
assert_eq!(content.content_type(), Some("image/png"));
sourcepub fn set_content_type<V>(&mut self, content_type: V)
pub fn set_content_type<V>(&mut self, content_type: V)
Set the type of the content.
§Examples
use atom_syndication::Content;
let mut content = Content::default();
content.set_content_type("image/png".to_string());
assert_eq!(content.content_type(), Some("image/png"));
Trait Implementations§
source§impl PartialEq for Content
impl PartialEq for Content
impl StructuralPartialEq for Content
Auto Trait Implementations§
impl Freeze for Content
impl RefUnwindSafe for Content
impl Send for Content
impl Sync for Content
impl Unpin for Content
impl UnwindSafe for Content
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