1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! # restless
//!
//! This is a crate that helps you specify your REST API in a typesafe manner. This is somewhat
//! similar to standards such as [OpenAPI](https://www.openapis.org/), which allow you to specify
//! your API in a cross-language manner. However, if both your frontend and your backend are
//! written in Rust, it is not neccessary to go through the trouble of specifying your APIs in a
//! spec like this. Rather, you can use the trait system to define your requests like this:
//!
//! ```rust
//! use restless::{*, data::Json};
//! use std::borrow::Cow;
//!
//! struct MyRequest {
//! name: String,
//! }
//!
//! impl GetRequest for MyRequest {
//! type Response = Json<Vec<String>>;
//! type Query = ();
//!
//! fn query(&self) -> Self::Query {}
//! fn path(&self) -> Cow<'_, str> {
//! "api/v1/my-request".into()
//! }
//! }
//! ```
//!
//! In this case, the response type is a JSON-encoded `Vec<String>`. Under the hood, `serde_json`
//! is used to provide this encoding. This crate ships with other encoding strategies, such as
//! using [`Yaml`](data::Yaml) or [`Bincode`](data::Bincode). You can also specify
//! [`Bytes`](bytes::Bytes) to get the raw data. By implementing the [`Decodable`](data::Decodable)
//! trait, you can augment it with your own, custom decoding strategy. The same goes for request
//! bodies with the [`Encodable`](data::Encodable) trait.
//!
//! ## Clients
//!
//! What you get "for free" from this crate is implementations of various clients. See the
//! [`clients`] module for more information.
//!
//! ## Examples
//!
//! To see some examples for how this crate may be used, refer to the `examples/` directory in the
//! [repository](https://github.com/xfbs/restless).
/// Integrations with HTTP clients.
/// Encoding traits and types.
///
/// Used to modify how request and response bodies are encoded and decoded.
/// Method wrappers.
/// Query mappers.
pub use ;
/// Utility traits.
pub use RequestExt;