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
79
use Deref;
use crateLookupResponse;
/// What a lookup answers.
///
/// An `Option` member is one your plan does not include. It never means "we
/// could not check", so `None` and `Some(false)` are genuinely different
/// answers: `None` is "not in your plan", `Some(false)` is "checked, and no".
/// This is the single most important semantic in the library, and it is why
/// every member a plan can leave out is an `Option`, the paid ones inside a
/// shared object too (`location.city`, `asn.rpki_status`).
///
/// A detail object that is present but empty means the flag above it is false.
/// A populated one always carries every one of its keys, empty values included.
///
/// The wire answer's fields are reachable straight off a `Lookup` through
/// [`Deref`], so `result.is_tor` and `result.location` read as if they were its
/// own, and [`Lookup::answer`] is the untouched wire object. `result.is_bogon`
/// is true for an answer computed locally, which happens for a bogon and only
/// for a bogon.
/// `result.is_tor` rather than `result.answer.is_tor`. `Lookup` hides nothing
/// of the served answer, so the deref is a widening rather than the inheritance
/// `Deref` is usually cautioned against.
/// Readers that treat "not in your plan" as false, for callers who only want to
/// know whether an address is flagged. Read the `Option` itself wherever absent
/// and false must be told apart, which is the whole reason they are options.
///
/// `result.is_hosting.unwrap_or(false)` says the same thing and is what the
/// README teaches; these exist so a long match arm does not have to.