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
//! The `RepeStruct` surface of [`repe`], on its own.
//!
//! A served struct's endpoints are declared where the *type* is declared, and
//! that is not always the crate that runs the RPC. A pure-logic crate — no I/O,
//! no `unsafe`, buildable on any host, and often kept that way deliberately —
//! should not have to acquire a server, a client, and a transport just to
//! publish a couple of paths. Its choices without this crate were to derive
//! nothing and concede the sub-paths, or to take the whole dependency.
//!
//! So this carries the four things a type needs to *be* served and nothing that
//! serves it:
//!
//! * [`RepeStruct`], the dispatch trait, and [`RepeMethods`], the method table
//! `#[repe::methods]` generates beside it;
//! * [`StructError`], what a handler reports;
//! * [`ResponseBody`], what a read encodes into;
//! * [`constants`], the protocol enums those two name.
//!
//! `repe` re-exports every one of them at the same paths, so a type derived
//! against this crate mounts on a `repe::Router` with nothing in between, and
//! `#[derive(RepeStruct)]` resolves its generated paths against whichever of the
//! two crates it finds.
//!
//! ```
//! use repe_core::RepeStruct;
//!
//! #[derive(serde::Serialize, serde::Deserialize, RepeStruct)]
//! struct Build {
//! version: String,
//! revision: u64,
//! }
//! ```
//!
//! [`repe`]: https://docs.rs/repe
//! [`RepeMethods`]: structs::RepeMethods
// Lets the derive macros emit `::repe_core` paths that resolve inside this crate
// as well as outside it. See `repe_derive::repe_crate_path`.
extern crate self as repe_core;
pub use ;
pub use ;
/// Derive macro generating a [`structs::RepeStruct`] implementation from a
/// struct's fields.
pub use RepeStruct;
/// Attribute macro that publishes every method of an inherent `impl` block,
/// generating the [`structs::RepeMethods`] table from the signatures themselves.
///
/// Pair it with `#[repe(methods)]` on the `#[derive(RepeStruct)]` struct; each
/// half asserts the other, so neither can be forgotten silently.
pub use methods;