[][src]Function bloguen::ops::feed_rss_header

pub fn feed_rss_header<W, E>(
    blog_name: &str,
    language: &LanguageTag,
    author: &str,
    link: Option<Cow<'static, str>>,
    into: &mut W,
    out_name_err: E
) -> Result<Cow<'static, str>, Error> where
    W: Write,
    E: Into<Cow<'static, str>>, 

Output the header for an RSS feed,

The link argument corresponds to the link tag, linking to the index page, and, if not present, will not be output.

Examples

let mut out = vec![];
let res = feed_rss_header(
    "Блогг", &LANGUAGE_EN_GB, "nabijaczleweli", Some("../index.html".into()),
    &mut out, "test blog");
assert_eq!(res, Ok("test blog".into()));

let out = str::from_utf8(&out).unwrap();
let gendate_local_rfc2822 = /* extracted from output's lastBuildDate tag */;
assert_eq!(out, format!(r###"<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
    <title>Блогг</title>
    <author>nabijaczleweli</author>
    <link>../index.html</link>
    <description>Блогг</description>
    <language>en-GB</language>
    <generator>bloguen 0.1.1</generator>
    <pubDate>{0}</pubDate>
    <lastBuildDate>{0}</lastBuildDate>
"###, gendate_local_rfc2822));