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
/// Build an owned argument map. Infallible for `Into<ConstraintValue>` values.
///
/// Structural bounds are applied later by [`Call::owned`] / the guard.
/// Does not accept a capability, policy, authority, or approval.
/// Build a [`ConstraintSet`] for one capability.
///
/// The authoring counterpart to [`args!`]: `args!` describes one call,
/// `constraints!` describes what calls a warrant permits. Values are anything
/// that converts into a `Constraint`.
///
/// ```
/// use tenuo::{constraints, Exact, Pattern};
///
/// let set = constraints! {
/// "path" => Pattern::new("/data/*").expect("valid glob"),
/// "mode" => Exact::new("read"),
/// };
/// assert!(set.get("path").is_some());
/// ```
///
/// An empty invocation is an open-world constraint set — every argument is
/// permitted. Prefer naming every field the capability accepts.
///
/// [`ConstraintSet`]: crate::ConstraintSet