Crate facet_atom

Crate facet_atom 

Source
Expand description

Atom Syndication Format (RFC 4287) types for facet-xml.

This crate provides strongly-typed Rust representations of Atom feed elements, enabling parsing and generation of Atom feeds using facet-xml.

§Example

use facet_atom::{Feed, Entry, Person, Link, TextContent, TextType};

let atom_xml = r#"<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Example Feed</title>
    <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
    <updated>2003-12-13T18:30:02Z</updated>
    <author>
        <name>John Doe</name>
    </author>
    <link href="http://example.org/"/>
    <entry>
        <title>Atom-Powered Robots Run Amok</title>
        <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
        <updated>2003-12-13T18:30:02Z</updated>
        <link href="http://example.org/2003/12/13/atom03"/>
        <summary>Some text.</summary>
    </entry>
</feed>"#;

let feed: Feed = facet_atom::from_str(atom_xml).unwrap();
assert_eq!(feed.title.as_ref().unwrap().content.as_deref(), Some("Example Feed"));
assert_eq!(feed.entries.len(), 1);

§Atom Namespace

All types use the Atom namespace http://www.w3.org/2005/Atom as specified in RFC 4287.

Re-exports§

pub use facet_xml;

Structs§

Category
A category for the feed or entry (<category>).
Content
The content of an entry (<content>).
Entry
An individual entry in an Atom feed (<entry>).
Feed
The top-level Atom feed document (<feed>).
Generator
Information about the software that generated the feed (<generator>).
Link
A link to a related resource (<link>).
Person
A person (author or contributor) in an Atom feed.
Source
Metadata about the original feed when an entry is copied (<source>).
TextContent
A text construct used for title, subtitle, summary, and rights.

Enums§

TextType
Content type for text constructs.

Constants§

ATOM_NS

Functions§

from_slice
Deserialize an Atom document from bytes.
from_str
Deserialize an Atom document from a string.
to_string
Serialize an Atom value to a string.

Type Aliases§

Error
Error type for Atom parsing
SerializeError
Error type for Atom serialization