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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! Where a host is willing to get a decoder from.
use fmt;
use Arc;
use DecoderRef;
/// Something that can produce the module for a decoder that is not in the container.
///
/// A resolver is whatever the host has: a directory of modules it ships, a cache, a registry
/// client, an operator who copied a file into place. This crate does not care which, and it does
/// not care whether the resolver checked anything, because whatever comes back is hashed against
/// the digest in the container before it goes anywhere.
///
/// Returning `None` is the ordinary answer for a decoder this host has no copy of. It is not an
/// error and it is not a refusal, it is a resolver saying it does not have that one.
/// What a host will run.
///
/// The default runs decoders embedded in the container and nothing else. That is the case the
/// format is designed around: the dataset carries the code that reads it, so there is nothing to
/// fetch and nothing to decide. A decoder named by a URI is a different proposition, because a
/// dataset that names one can cause a host to go and get something and then execute it, and this
/// crate will not do that unless a host has said so with a resolver of its own.
///
/// There is no boolean here on purpose. Turning external decoders on means writing the thing that
/// goes and finds them, which is not something anybody does by accident.
// Written out rather than derived because `Arc<dyn Resolve>` cannot be derived through, and because
// what a reader wants from a policy in a log line is whether external decoders are on, not the
// address of a trait object.