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
//! A developer-friendly, featherlight and functional HTTP(S) mock server
//! built in Rust, based on [hyper](https://hyper.rs/) and [tokio](https://tokio.rs/).
//!
//! # Workspace layout (5.0.0+)
//!
//! Starting with 5.0.0, apimock is split across four crates. This crate
//! (`apimock`) is a thin façade that re-exports the three member crates
//! and provides the CLI entry point:
//!
//! - [`apimock_config`] — the TOML config model; loading, validation,
//! and (coming in stage 2) the GUI-facing edit API.
//! - [`apimock_routing`] — rule-set definitions, matching, and the
//! read-only view types a GUI binds against.
//! - [`apimock_server`] — HTTP listener, request dispatch, middleware
//! compilation.
//!
//! Most existing code that did `use apimock::core::…` can migrate by
//! replacing the prefix with the appropriate re-export below. For
//! example, `apimock::core::server::routing::rule_set::RuleSet` is now
//! `apimock::routing::RuleSet` (or, equivalently,
//! `apimock_routing::RuleSet`).
// Re-export the three member crates under shorter names so downstream
// code doesn't need to add them to Cargo.toml individually unless it
// wants to pin different versions.
pub use apimock_config as config;
pub use apimock_routing as routing;
pub use apimock_server as server;
pub use App;
pub use EnvArgs;
/// Build the app (default feature).
///
/// Returns a `Result` whose error side is `apimock_server::ServerError`,
/// which itself `#[from]`-wraps `ConfigError` and (via that)
/// `RoutingError`. At the binary's process boundary we flatten all of
/// these into `anyhow::Error`.
pub async
use Sender;
/// Build the app under the `spawn` feature.
///
/// - `spawn_tx`: channel to forward log output to the embedding process.
/// - `includes_ansi_codes`: if `true`, forwarded log lines retain ANSI
/// colour escapes.
pub async