Skip to main content

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::{
22	Cache, CacheMode, CacheOptions, HttpCache, HttpCacheOptions, MokaManager,
23};
24
25#[cfg(feature = "client")]
26pub mod client;
27#[cfg(feature = "server")]
28pub mod server;
29
30/// Returns a HTTP caching middleware with appropriate settings for
31/// matrix-oracle's use-case.
32pub(crate) fn cache() -> Cache<MokaManager> {
33	Cache(HttpCache {
34		mode: CacheMode::Default,
35		manager: MokaManager::default(),
36		options: HttpCacheOptions {
37			cache_options: Some(CacheOptions { shared: false, ..CacheOptions::default() }),
38			..HttpCacheOptions::default()
39		},
40	})
41}