Struct opml::Outline

source ·
pub struct Outline {
Show 14 fields pub text: String, pub type: Option<String>, pub is_comment: Option<bool>, pub is_breakpoint: Option<bool>, pub created: Option<String>, pub category: Option<String>, pub outlines: Vec<Outline>, pub xml_url: Option<String>, pub description: Option<String>, pub html_url: Option<String>, pub language: Option<String>, pub title: Option<String>, pub version: Option<String>, pub url: Option<String>,
}
Expand description

The Outline element.

Fields§

§text: String

Every outline element must have at least a text attribute, which is what is displayed when an outliner opens the OPML document.

Version 1.0 OPML documents may omit this attribute, so for compatibility and strictness this attribute is “technically optional” as it will be replaced by an empty String if it is omitted.

Text attributes may contain encoded HTML markup.

§type: Option<String>

A string that indicates how the other attributes of the Outline should be interpreted.

§is_comment: Option<bool>

Indicating whether the outline is commented or not. By convention if an outline is commented, all subordinate outlines are considered to also be commented.

§is_breakpoint: Option<bool>

Indicating whether a breakpoint is set on this outline. This attribute is mainly necessary for outlines used to edit scripts.

§created: Option<String>

The date-time (RFC822) that this Outline element was created.

§category: Option<String>

A string of comma-separated slash-delimited category strings, in the format defined by the RSS 2.0 category element. To represent a “tag”, the category string should contain no slashes.

§outlines: Vec<Outline>

Child Outline elements of the current one.

§xml_url: Option<String>

The HTTP address of the feed.

§description: Option<String>

The top-level description element from the feed.

§html_url: Option<String>

The top-level link element from the feed.

§language: Option<String>

The top-level language element from the feed.

§title: Option<String>

The top-level title element from the feed.

§version: Option<String>

The version of the feed’s format (such as RSS 0.91, 2.0, …).

§url: Option<String>

A link that can point to another OPML document or to something that can be displayed in a web browser.

Implementations§

source§

impl Outline

source

pub fn add_feed(&mut self, name: &str, url: &str) -> &mut Self

Helper function to add an Outline element with text and xml_url attributes as a child element, useful for creating grouped lists. This function also exists as OPML::add_feed for non-grouped lists.

Example
use opml::Outline;

let mut group = Outline::default();
group.add_feed("Feed Name", "https://example.com/");
let added_feed = group.outlines.first().unwrap();

let expected_feed = &Outline {
  text: "Feed Name".to_string(),
  xml_url: Some("https://example.com/".to_string()),
  ..Outline::default()
};

assert_eq!(added_feed, expected_feed);

Trait Implementations§

source§

impl Clone for Outline

source§

fn clone(&self) -> Outline

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 Outline

source§

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

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

impl Default for Outline

source§

fn default() -> Outline

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

impl<'de> Deserialize<'de> for Outline

source§

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 Outline

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Outline

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<'__input> XmlRead<'__input> for Outline

source§

fn from_reader(reader: &mut XmlReader<'__input>) -> XmlResult<Self>

source§

fn from_str(text: &'a str) -> Result<Self, XmlError>

source§

impl XmlWrite for Outline

source§

fn to_writer<W: Write>(&self, writer: &mut XmlWriter<W>) -> XmlResult<()>

source§

fn to_string(&self) -> Result<String, XmlError>

source§

impl Eq for Outline

source§

impl StructuralEq for Outline

source§

impl StructuralPartialEq for Outline

Auto Trait Implementations§

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> 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,

§

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>,

§

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>,

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> XmlReadOwned for T
where T: for<'s> XmlRead<'s>,