Expand description
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, andRepeMethods, 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,
}Re-exports§
pub use constants::BodyFormat;pub use constants::ErrorCode;pub use constants::HEADER_SIZE;pub use constants::QueryFormat;pub use constants::REPE_SPEC;pub use constants::REPE_VERSION;pub use structs::RepeStruct;pub use structs::ResponseBody;pub use structs::StructError;
Modules§
Attribute Macros§
- methods
- Attribute macro that publishes every method of an inherent
implblock, generating thestructs::RepeMethodstable from the signatures themselves.
Derive Macros§
- Repe
Struct - Derive macro generating a
structs::RepeStructimplementation from a struct’s fields.