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
80
81
82
83
//! Defines the [`Owner`] and [`HasDependent`] traits, the common interface for
//! types stored in a [`Pair`](crate::Pair).
/// Defines the dependent type for the [`Owner`] trait.
///
/// Semantically, you can think of this like a lifetime Generic Associated Type
/// (GAT) in the `Owner` trait - the two behave very similarly, and serve the
/// same role in defining a [`Dependent`](HasDependent::Dependent) type, generic
/// over some lifetime.
///
/// A real GAT is not used due to limitations in the Rust compiler. For the
/// technical details on this, I recommend Sabrina Jewson's blog post on
/// [The Better Alternative to Lifetime GATs].
///
/// [The Better Alternative to Lifetime GATs]: https://sabrinajewson.org/blog/the-better-alternative-to-lifetime-gats
/// A type alias for the [`Dependent`](HasDependent::Dependent) of some
/// [`Owner`] with a specific lifetime `'owner`.
pub type Dependent<'owner, O> = Dependent;
/// A type which can act as the "owner" of some data, and can produce some
/// dependent type which borrows from `Self`. Used for the [`Pair`](crate::Pair)
/// struct.
///
/// The supertrait [`HasDependent`] defines the dependent type, acting as a sort
/// of generic associated type - see its documentation for more information. The
/// [`make_dependent`](Owner::make_dependent) function defines how to create a
/// dependent from a reference to an owner.
/// Used to prevent implementors of [`HasDependent`] from overriding the
/// `ForImpliedBounds` generic type from its default.
use ;