sitemapo 0.1.0

The implementation of the Sitemap.xml (or URL inclusion) protocol with the support of txt, xml formats and video, image, and news extensions
Documentation

sitemapo

Build Status Crate Docs Crate Version Crate Coverage

Also check out other xwde projects here.

The implementation of the Sitemap (or URL inclusion) protocol in the Rust programming language with the support of txt, xml formats and video, image, news extensions (according to the Google's spec).

Features

  • extension to enable all XML sitemap extensions. Enabled by default.
  • tokio to enable asynchronous parsers/builders.

Examples

  • parser
use std::io::BufReader;
use url::Url;
use sitemapo::{Parser, TxtParser};

fn main() {
    let url = "https://example.com/file1.html";
    let buf = BufReader::new(url.as_bytes());
    let mut parser = TxtParser::new(buf).unwrap();
    
    let rec = parser.read().unwrap();
    let buf = parser.close().unwrap();
}
  • builder
use url::Url;
use sitemapo::{Builder, XmlBuilder};
use sitemapo::record::EntryRecord;

fn main() {
    let buf = Vec::new();
    let mut builder = XmlBuilder::new(buf).unwrap();
    
    let url = Url::parse("https://example.com/").unwrap();
    let rec = EntryRecord::new(url);
    builder.write(&rec).unwrap();
    let buf = builder.close().unwrap();
}

Links