sitemapo 0.2.0

The implementation of the Sitemap.xml (or URL inclusion) protocol with the support of txt & xml formats, and video, image, news extensions.
Documentation
#![forbid(unsafe_code)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![doc = include_str!("./README.md")]

/// Unrecoverable failure during sitemap building or parsing.
///
/// This may be extended in the future so exhaustive matching is discouraged.
#[derive(Debug, thiserror::Error)]
pub enum Error {
    /// Added for convinience while construction records.
    #[error("url parsing error: {0}")]
    Url(#[from] url::ParseError),

    /// Parsers/builders enforce byte limit. See [record::BYTE_LIMIT].
    #[error("too many records: {over} entries over limit")]
    EntryLimit { over: usize },

    /// Parsers/builders enforce byte limit. See [record::RECORD_LIMIT].
    #[error("too many bytes: {over} bytes over limit")]
    ByteLimit { over: usize },

    /// Underlying reader/writer IO failure.
    #[error("io error: {0}")]
    Io(#[from] std::io::Error),

    /// XML parser/builder failure.
    #[error("internal xml error: {0}")]
    Xml(#[from] quick_xml::Error),
}

// Re-exports
pub use parse::AutoParser;
pub use url;

/// Attribute types: `Frequency` and `Priority`.
pub mod attribute;
/// Builder types: `TxtBuilder` & `XmlBuilder`.
pub mod build;
/// Parser types: `AutoParser`, `TxtParser` & `XmlParser`.
pub mod parse;
/// Record types: `EntryRecord` & `IndexRecord`.
pub mod record;

#[doc(hidden)]
pub mod prelude {
    pub use super::Error;

    pub use super::attribute::*;
    pub use super::build::*;
    pub use super::parse::*;
    pub use super::record::*;
}