indieweb/lib.rs
1//! This crate provides implementations of the [standards][standards] and [algorithms][algorithms] used with the IndieWeb.
2//!
3//! More information about what's available is in either the [algorithms][algorithms] or
4//! [standards][standards] module. A required trait to use is the [HTTP Client][http::Client]
5//! if you'd like to use your own networking stack that's compatible with [http][::http]. This
6//! library also provides some [traits][traits] to extend common values with IndieWeb-adjacent
7//! capabilities.
8//!
9//! # Quick Start
10//!
11//! ```
12//! use indieweb::prelude::*;
13//! ```
14//!
15#![warn(invalid_doc_attributes, unused, deprecated, clippy::perf)]
16#![deny(rustdoc::broken_intra_doc_links, dead_code, unsafe_code)]
17
18/// A collection of algorithms commonly used in the IndieWeb.
19/// This module provides a collection of implementation of known
20/// algorithms when working with the IndieWeb or adjacent tooling.
21pub mod algorithms;
22
23/// A representation of errors from the IndieWeb error.
24pub mod error;
25
26/// A facade for HTTP interactions when working with this library.
27pub mod http;
28
29/// A collection of standards that the IndieWeb can support.
30///
31/// View <https://spec.indieweb.org> for more information.
32pub mod standards;
33
34/// Traits to extend everyday functionality with IndieWeb-adjacent tooling.
35pub mod traits;
36
37/// A prelude module for ergonomic imports.
38///
39/// ```
40/// use indieweb::prelude::*;
41/// ```
42pub mod prelude;
43
44mod test;
45
46// ============================================================================
47// Re-exports for microformats (core to this library)
48// ============================================================================
49pub use microformats as mf2;
50pub use mf2::parse as parser;
51pub use mf2::types::{Document, Item, PropertyValue};
52
53// ============================================================================
54// Re-exports for HTTP clients (for simpler imports)
55//
56// These provide flatter import paths:
57// - indieweb::ReqwestClient (instead of indieweb::http::reqwest::Client)
58// - indieweb::BlockingClient (instead of indieweb::http::blocking::Client)
59// - indieweb::MiddlewareClient (instead of indieweb::http::MiddlewareClient)
60// ============================================================================
61#[cfg(feature = "reqwest")]
62pub use http::reqwest::Client as ReqwestClient;
63
64#[cfg(feature = "blocking")]
65pub use http::blocking::Client as BlockingClient;
66
67#[cfg(feature = "reqwest_middleware")]
68pub use http::MiddlewareClient;
69
70/// Result type alias for convenience
71pub use error::Error;
72pub type Result<T, E = Error> = std::result::Result<T, E>;