-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathdiagnostics.rs
More file actions
32 lines (28 loc) · 944 Bytes
/
diagnostics.rs
File metadata and controls
32 lines (28 loc) · 944 Bytes
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
use dptree::prelude::*;
#[derive(Clone)]
struct A;
#[derive(Clone)]
struct B;
#[derive(Clone)]
struct C;
#[derive(Clone)]
struct D;
#[tokio::main]
async fn main() {
let h: Handler<D> = dptree::entry().map(|_: A| B).inspect(|_: C| ()).endpoint(|| async { D });
// Missing `A` and `C` in the dependency map (see the panic message below).
dptree::type_check(h.sig(), &dptree::deps![B, D], &[]);
}
// thread 'main' panicked at src/handler/core.rs:551:17:
// Your handler accepts the following types:
// `diagnostics::A`
// `diagnostics::C`
// But only the following values were given to it:
// `diagnostics::B`
// `diagnostics::D`
// The missing values are:
// `diagnostics::A` from examples/diagnostics.rs:14:41
// `diagnostics::C` from examples/diagnostics.rs:14:55
//
// Make sure all the required values are provided to the handler. For more information, visit <https://docs.rs/dptree/latest/dptree>.
//