Crate jsonfeed [] [src]

JSON Feed is a syndication format similar to ATOM and RSS, using JSON instead of XML

This crate can serialize and deserialize between JSON Feed strings and Rust data structures. It also allows for programmatically building a JSON Feed

Example:

extern crate jsonfeed;

use jsonfeed::{Feed, Item};

fn run() -> Result<(), jsonfeed::Error> {
    let j = r#"{
        "title": "my feed",
        "version": "https://jsonfeed.org/version/1",
        "items": []
    }"#;
    let feed = jsonfeed::from_str(j).unwrap();

    let new_feed = Feed::builder()
                        .title("some other feed")
                        .item(Item::builder()
                                .title("some item title")
                                .content_html("<p>Hello, World</p>")
                                .build()?)
                        .item(Item::builder()
                                .title("some other item title")
                                .content_text("Hello, World!")
                                .build()?)
                        .build();
    println!("{}", jsonfeed::to_string(&new_feed).unwrap());
    Ok(())
}
fn main() {
    let _ = run();
}

Structs

Attachment

Represents an attachment for an item

Author

Represents an author in both a feed and a feed item

Error

The Error type.

Feed

Represents a single feed

Item

Represents an item in a feed

Enums

Content

Represents the content_html and content_text attributes of an item

ErrorKind

The kind of an error.

Traits

ResultExt

Additional methods for Result, for easy interaction with this crate.

Functions

from_reader

Deserialize a Feed object from an IO stream of JSON

from_slice

Deserialize a Feed object from bytes of JSON text

from_str

Attempts to convert a string slice to a Feed object

from_value

Convert a serde_json::Value type to a Feed object

to_string

Serialize a Feed to a JSON Feed string

to_string_pretty

Pretty-print a Feed to a JSON Feed string

to_value

Convert a Feed to a serde_json::Value

to_vec

Convert a Feed to a vector of bytes of JSON

to_vec_pretty

Convert a Feed to a vector of bytes of pretty-printed JSON

to_writer

Serialize a Feed to JSON and output to an IO stream

to_writer_pretty

Serialize a Feed to pretty-printed JSON and output to an IO stream

Type Definitions

Result

Convenient wrapper around std::Result.