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
//! Provider names, the hosts that supply skills Mars installs outside the dependency graph.
//!
//! A provider is the name a host program gives what it provides (`meridian`), and it is its own
//! namespace: separate from dependency keys, dependency-declared refs must opt in with
//! `[package] uses-providers`. Skills it provides are named `<skill>__<provider>`, so a ref's
//! validity depends only on the package, never on what a machine happens to have installed.
/// The provider-name grammar: `[a-z0-9][a-z0-9-]*`.
///
/// Excludes `__`, `@` and `=` so a provider name can never be confused with a skill name's
/// separator or the `mars provide` spec syntax.
/// The provider a skill name belongs to: the suffix after its last `__`.
///
/// Returns `None` for an unprefixed name (`notify`) and for a name whose suffix is not a provider
/// name (`notify__Not-Provider`), so an author cannot claim a provider ref by spelling alone.
/// The provider a ref is deferred to, when the requesting package declares it.
///
/// The package-only half of a ref's validity: `<x>__<p>` is valid wherever `p` supplies it when
/// the package lists `p` in `[package] uses-providers`. Selection and `mars check` ask only
/// this question, so a package resolves the same on every machine; sync's validator is the one
/// reporter that also knows what this machine installed.
///
/// `declared` is the requesting package's `uses-providers`: `Some` for a package (a dependency,
/// or a package repository's own items), `None` for a consumer project's local items, which need
/// no declaration.
/// The hint for a `<skill>__<provider>` ref that no package ships and no package declares.
///
/// A name can look exactly like a host provider's and still be a typo, so the hint is
/// conditional. Selection's missing-skill report carries this one text (`MissingSkill::hint`), and `mars check` prints it.
pub