[][src]Struct atom_syndication::Content

pub struct Content {
    pub value: Option<String>,
    pub src: Option<String>,
    pub content_type: Option<String>,
}

Represents the content of an Atom entry

Fields

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

impl Content[src]

pub fn value(&self) -> Option<&str>[src]

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"));

pub fn set_value<V>(&mut self, value: V) where
    V: Into<Option<String>>, 
[src]

Set the text value of the content.

Examples

use atom_syndication::Content;

let mut content = Content::default();
content.set_value("Example content".to_string());

pub fn src(&self) -> Option<&str>[src]

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"));

pub fn set_src<V>(&mut self, src: V) where
    V: Into<Option<String>>, 
[src]

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());

pub fn content_type(&self) -> Option<&str>[src]

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"));

pub fn set_content_type<V>(&mut self, content_type: V) where
    V: Into<Option<String>>, 
[src]

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

impl Clone for Content[src]

impl Debug for Content[src]

impl Default for Content[src]

impl PartialEq<Content> for Content[src]

impl StructuralPartialEq for Content[src]

Auto Trait Implementations

impl RefUnwindSafe for Content

impl Send for Content

impl Sync for Content

impl Unpin for Content

impl UnwindSafe for Content

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.