matrix_oracle/
lib.rs

1//! Matrix-oracle is a crate for performing lookups of .well-known information
2//! for the matrix protocol.
3//!
4//! # Features
5#![cfg_attr(doc, doc = document_features::document_features!())]
6#![deny(
7	trivial_casts,
8	trivial_numeric_casts,
9	unused_extern_crates,
10	unused_import_braces,
11	unused_qualifications
12)]
13#![warn(
14	missing_debug_implementations,
15	missing_docs,
16	dead_code,
17	clippy::unwrap_used,
18	clippy::expect_used
19)]
20
21use http_cache_reqwest::{Cache, CacheMode, CacheOptions, HttpCache, MokaManager};
22
23#[cfg(feature = "client")]
24pub mod client;
25#[cfg(feature = "server")]
26pub mod server;
27
28/// Returns a HTTP caching middleware with appropriate settings for
29/// matrix-oracle's use-case.
30pub(crate) fn cache() -> Cache<MokaManager> {
31	Cache(HttpCache {
32		mode: CacheMode::Default,
33		manager: MokaManager::default(),
34		options: Some(CacheOptions { shared: false, ..CacheOptions::default() }),
35	})
36}