Skip to main content

tako_rs_extractors/
lib.rs

1#![cfg_attr(docsrs, feature(doc_cfg))]
2// `FromRequest`/`FromRequestParts` implementations keep the explicit
3// `fn(...) -> impl Future + Send + 'a` form so the returned future stays `Send`
4// for hyper's service bound. See the matching allow on `tako-core`.
5#![allow(clippy::manual_async_fn)]
6
7//! Concrete request extractor implementations for the Tako framework.
8//!
9//! The `FromRequest` and `FromRequestParts` traits live in `tako-core`. The
10//! `Json` and `Params` extractors also stay there because their internal types
11//! are referenced by the router. Everything else (`header_map`, cookies, query,
12//! path, form, ipaddr, accept, basic/bearer auth, jwt, byte body, range,
13//! state, plus the optional multipart/protobuf/simdjson and zero-copy variants)
14//! lives here. Re-exported under `tako::extractors::*` via the umbrella crate.
15
16/// Accept-Language header parsing and locale extraction.
17pub mod acc_lang;
18
19/// Content negotiation via Accept header parsing.
20pub mod accept;
21
22/// Basic HTTP authentication credential extraction.
23pub mod basic;
24
25/// Bearer token authentication extraction from Authorization header.
26pub mod bearer;
27
28/// Raw byte data extraction from request bodies.
29pub mod bytes;
30
31/// `ConnectInfo<T>` typed view over `tako_rs_core::conn_info::ConnInfo`.
32pub mod connect_info;
33
34/// `ContentLengthLimit<T, N>` body-bound extractor wrapper.
35pub mod content_length_limit;
36
37/// `Extension<T>` typed extractor for request-scoped values.
38pub mod extension;
39
40/// `MatchedPath` extractor — the route template that matched the request.
41pub mod matched_path;
42
43/// URI-derived extractors (`OriginalUri`, `Host`, `Scheme`).
44pub mod uri_parts;
45
46/// `TypedHeader<H>` strongly-typed header extractor (requires `typed-header` feature).
47#[cfg(feature = "typed-header")]
48#[cfg_attr(docsrs, doc(cfg(feature = "typed-header")))]
49pub mod typed_header;
50
51/// Cookie parsing and management utilities.
52pub mod cookie_jar;
53
54/// Cookie key derivation and expansion for encryption/signing.
55pub mod cookie_key_expansion;
56
57/// Private (encrypted) cookie handling with automatic decryption.
58pub mod cookie_private;
59
60/// Signed cookie handling with HMAC verification.
61pub mod cookie_signed;
62
63/// Form data (application/x-www-form-urlencoded) parsing.
64pub mod form;
65
66/// HTTP header map extraction and manipulation.
67pub mod header_map;
68
69/// IP address extraction from request headers and connection info.
70pub mod ipaddr;
71
72/// JSON Web Token (JWT) handling with HMAC verification.
73pub mod jwt;
74
75/// URL path component extraction and manipulation.
76pub mod path;
77
78/// Query parameter parsing from URL query strings.
79pub mod query;
80
81/// Multi-value query parser preserving repeated keys and CSV expansions.
82pub mod query_multi;
83
84/// `Validated<T>` wrapper that runs `validator` / `garde` rules after extraction.
85#[cfg(any(feature = "validator", feature = "garde"))]
86#[cfg_attr(docsrs, doc(cfg(any(feature = "validator", feature = "garde"))))]
87pub mod validate;
88
89/// Global state extraction for accessing shared app state.
90pub mod state;
91
92/// Multipart form data parsing for file uploads and complex forms.
93#[cfg(feature = "multipart")]
94#[cfg_attr(docsrs, doc(cfg(feature = "multipart")))]
95pub mod multipart;
96
97/// Protobuf request body parsing and deserialization.
98#[cfg(feature = "protobuf")]
99#[cfg_attr(docsrs, doc(cfg(feature = "protobuf")))]
100pub mod protobuf;
101
102/// High-performance JSON parsing using SIMD acceleration.
103#[cfg(feature = "simd")]
104#[cfg_attr(docsrs, doc(cfg(feature = "simd")))]
105pub mod simdjson;
106
107/// Zero-copy extraction helpers.
108#[cfg(feature = "zero-copy-extractors")]
109#[cfg_attr(docsrs, doc(cfg(feature = "zero-copy-extractors")))]
110pub mod zero_copy_extractors;