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
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
// Copyright (c) 2021 Sebastien Braun
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

//! Shorthand type aliases to refer to [`Eso`](Eso) with different combinations of
//! type parameters.
//!
//! Import the sub-modules [`t`], [`s`] or [`x`] qualified to use them:
//!
//! ```
//! # use ::eso::{eso, maybe::{An,No}, shorthand::t};
//! type MyString<'a> = t::ESO<&'a str, &'static str, String>;
//! type Expanded<'a> = eso::Eso<An<&'a str>, An<&'static str>, An<String>>;
//! let a_str: MyString<'_> = MyString::from_static("Hello World");
//! let a_str: Expanded<'_> = a_str;
//! ```

use crate::eso::Eso;
#[allow(unused_imports)] // for doc comments
use crate::maybe::Maybe;

/// Shorthand type aliases for [`Eso`].
///
/// The type names derive from the three components `E`, `S`, `O`,
/// but the input type arguments are transformed according to the
/// rules:
///
/// | Rule      | Type parameter  | Transformed to | Meaning      |
/// |-----------|-----------------|----------------|--------------|
/// | Uppercase | `T`: value      | `An<T>`        | present      |
/// | Missing   | `T`: value      | `No<T>`        | absent       |
/// | Lowercase | `MT`: [`Maybe`] | `MT`           | pass-through |
#[allow(non_camel_case_types, missing_docs, clippy::upper_case_acronyms)]
pub mod t {
    use crate::maybe::{An, No};

    /// [`Eso`](super::Eso) with `E` present, `S` present, `O` present, see [shorthand module docs](super::t)
    pub type ESO<E, S, O> = super::Eso<An<E>, An<S>, An<O>>;

    /// [`Eso`](super::Eso) with `E` present, `S` present, `O` pass-through, see [shorthand module docs](super::t)
    pub type ESo<E, S, MO> = super::Eso<An<E>, An<S>, MO>;

    /// [`Eso`](super::Eso) with `E` present, `S` pass-through, `O` present, see [shorthand module docs](super::t)
    pub type EsO<E, MS, O> = super::Eso<An<E>, MS, An<O>>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` present, `O` present, see [shorthand module docs](super::t)
    pub type eSO<ME, S, O> = super::Eso<ME, An<S>, An<O>>;

    /// [`Eso`](super::Eso) with `E` present, `S` pass-through, `O` pass-through, see [shorthand module docs](super::t)
    pub type Eso<E, MS, MO> = super::Eso<An<E>, MS, MO>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` present, `O` pass-through, see [shorthand module docs](super::t)
    pub type eSo<ME, S, MO> = super::Eso<ME, An<S>, MO>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` pass-through, `O` present, see [shorthand module docs](super::t)
    pub type esO<ME, MS, O> = super::Eso<ME, MS, An<O>>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` pass-through, `O` pass-through - actually an alias for [`Eso`], see [shorthand module docs](super::t)
    pub type eso<ME, MS, MO> = super::Eso<ME, MS, MO>;

    /// [`Eso`](super::Eso) with `E` present, `S` present, `O` absent, see [shorthand module docs](super::t)
    pub type ES<E, S, O> = super::Eso<An<E>, An<S>, No<O>>;

    /// [`Eso`](super::Eso) with `E` present, `S` pass-through, `O` absent, see [shorthand module docs](super::t)
    pub type Es<E, MS, O> = super::Eso<An<E>, MS, No<O>>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` present, `O` absent, see [shorthand module docs](super::t)
    pub type eS<ME, S, O> = super::Eso<ME, An<S>, No<O>>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` pass-through, `O` absent, see [shorthand module docs](super::t)
    pub type es<ME, MS, O> = super::Eso<ME, MS, No<O>>;

    /// [`Eso`](super::Eso) with `E` present, `S` absent, `O` present, see [shorthand module docs](super::t)
    pub type EO<E, S, O> = super::Eso<An<E>, No<S>, An<O>>;

    /// [`Eso`](super::Eso) with `E` present, `S` absent, `O` pass-through, see [shorthand module docs](super::t)
    pub type Eo<E, S, MO> = super::Eso<An<E>, No<S>, MO>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` absent, `O` present, see [shorthand module docs](super::t)
    pub type eO<ME, S, O> = super::Eso<ME, No<S>, An<O>>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` absent, `O` pass-through, see [shorthand module docs](super::t)
    pub type eo<ME, S, MO> = super::Eso<ME, No<S>, MO>;

    /// [`Eso`](super::Eso) with `E` absent, `S` present, `O` present, see [shorthand module docs](super::t)
    pub type SO<E, S, O> = super::Eso<No<E>, An<S>, An<O>>;

    /// [`Eso`](super::Eso) with `E` absent, `S` present, `O` pass-through, see [shorthand module docs](super::t)
    pub type So<E, S, MO> = super::Eso<No<E>, An<S>, MO>;

    /// [`Eso`](super::Eso) with `E` absent, `S` pass-through, `O` present, see [shorthand module docs](super::t)
    pub type sO<E, MS, O> = super::Eso<No<E>, MS, An<O>>;

    /// [`Eso`](super::Eso) with `E` absent, `S` pass-through, `O` pass-through, see [shorthand module docs](super::t)
    pub type so<E, MS, MO> = super::Eso<No<E>, MS, MO>;

    /// [`Eso`](super::Eso) with `E` present, `S` absent, `O` absent, see [shorthand module docs](super::t)
    pub type E<E, S, O> = super::Eso<An<E>, No<S>, No<O>>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` absent, `O` absent, see [shorthand module docs](super::t)
    pub type e<ME, S, O> = super::Eso<ME, No<S>, No<O>>;

    /// [`Eso`](super::Eso) with `E` absent, `S` present, `O` absent, see [shorthand module docs](super::t)
    pub type S<E, S, O> = super::Eso<No<E>, An<S>, No<O>>;

    /// [`Eso`](super::Eso) with `E` absent, `S` pass-through, `O` absent, see [shorthand module docs](super::t)
    pub type s<E, MS, O> = super::Eso<No<E>, MS, No<O>>;

    /// [`Eso`](super::Eso) with `E` absent, `S` absent, `O` present, see [shorthand module docs](super::t)
    pub type O<E, S, O> = super::Eso<No<E>, No<S>, An<O>>;

    /// [`Eso`](super::Eso) with `E` absent, `S` absent, `O` pass-through, see [shorthand module docs](super::t)
    pub type o<E, S, MO> = super::Eso<No<E>, No<S>, MO>;

    /// [`Eso`](super::Eso) with `E` absent, `S` absent, `O` absent - this is [`Impossible`](crate::maybe::Impossible), see [shorthand module docs](super::t)
    pub type None<E, S, O> = super::Eso<No<E>, No<S>, No<O>>;
}

/// Shorthand type aliases for transformations of an [`Eso`].
///
/// The type names derive from the three components `ME`, `MS`, `MO`,
/// but the input type arguments are transformed according to the
/// rules:
///
/// | Rule      | Type parameter  | Transformed to | Meaning      |
/// |-----------|-----------------|----------------|--------------|
/// | Uppercase | `MT`: [`Maybe`] | `An<T::Inner>` | present      |
/// | Missing   | `MT`: [`Maybe`] | `No<T::Inner>` | absent       |
/// | Lowercase | `MT`: [`Maybe`] | `MT`           | pass-through |
#[allow(non_camel_case_types, missing_docs, clippy::upper_case_acronyms)]
pub mod x {
    use crate::maybe::{An, Maybe, No};

    /// [`Eso`](super::Eso) with `E` present, `S` present, `O` present, see [shorthand module docs](super::x)
    pub type ESO<ME, MS, MO> =
        super::Eso<An<<ME as Maybe>::Inner>, An<<MS as Maybe>::Inner>, An<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` present, `S` present, `O` pass-through, see [shorthand module docs](super::x)
    pub type ESo<ME, MS, MO> = super::Eso<An<<ME as Maybe>::Inner>, An<<MS as Maybe>::Inner>, MO>;

    /// [`Eso`](super::Eso) with `E` present, `S` pass-through, `O` present, see [shorthand module docs](super::x)
    pub type EsO<ME, MS, MO> = super::Eso<An<<ME as Maybe>::Inner>, MS, An<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` present, `O` present, see [shorthand module docs](super::x)
    pub type eSO<ME, MS, MO> = super::Eso<ME, An<<MS as Maybe>::Inner>, An<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` present, `S` pass-through, `O` pass-through, see [shorthand module docs](super::x)
    pub type Eso<ME, MS, MO> = super::Eso<An<<ME as Maybe>::Inner>, MS, MO>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` present, `O` pass-through, see [shorthand module docs](super::x)
    pub type eSo<ME, MS, MO> = super::Eso<ME, An<<MS as Maybe>::Inner>, MO>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` pass-through, `O` present, see [shorthand module docs](super::x)
    pub type esO<ME, MS, MO> = super::Eso<ME, MS, An<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` pass-through, `O` pass-through - actually an alias for [`Eso`], see [shorthand module docs](super::x)
    pub type eso<ME, MS, MO> = super::Eso<ME, MS, MO>;

    /// [`Eso`](super::Eso) with `E` present, `S` present, `O` absent, see [shorthand module docs](super::x)
    pub type ES<ME, MS, MO> =
        super::Eso<An<<ME as Maybe>::Inner>, An<<MS as Maybe>::Inner>, No<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` present, `S` pass-through, `O` absent, see [shorthand module docs](super::x)
    pub type Es<ME, MS, MO> = super::Eso<An<<ME as Maybe>::Inner>, MS, No<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` present, `O` absent, see [shorthand module docs](super::x)
    pub type eS<ME, MS, MO> = super::Eso<ME, An<<MS as Maybe>::Inner>, No<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` pass-through, `O` absent, see [shorthand module docs](super::x)
    pub type es<ME, MS, MO> = super::Eso<ME, MS, No<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` present, `S` absent, `O` present, see [shorthand module docs](super::x)
    pub type EO<ME, MS, MO> =
        super::Eso<An<<ME as Maybe>::Inner>, No<<MS as Maybe>::Inner>, An<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` present, `S` absent, `O` pass-through, see [shorthand module docs](super::x)
    pub type Eo<ME, MS, MO> = super::Eso<An<<ME as Maybe>::Inner>, No<<MS as Maybe>::Inner>, MO>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` absent, `O` present, see [shorthand module docs](super::x)
    pub type eO<ME, MS, MO> = super::Eso<ME, No<<MS as Maybe>::Inner>, An<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` absent, `O` pass-through, see [shorthand module docs](super::x)
    pub type eo<ME, MS, MO> = super::Eso<ME, No<<MS as Maybe>::Inner>, MO>;

    /// [`Eso`](super::Eso) with `E` absent, `S` present, `O` present, see [shorthand module docs](super::x)
    pub type SO<ME, MS, MO> =
        super::Eso<No<<ME as Maybe>::Inner>, An<<MS as Maybe>::Inner>, An<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` absent, `S` present, `O` pass-through, see [shorthand module docs](super::x)
    pub type So<ME, MS, MO> = super::Eso<No<<ME as Maybe>::Inner>, An<<MS as Maybe>::Inner>, MO>;

    /// [`Eso`](super::Eso) with `E` absent, `S` pass-through, `O` present, see [shorthand module docs](super::x)
    pub type sO<ME, MS, MO> = super::Eso<No<<ME as Maybe>::Inner>, MS, An<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` absent, `S` pass-through, `O` pass-through, see [shorthand module docs](super::x)
    pub type so<ME, MS, MO> = super::Eso<No<<ME as Maybe>::Inner>, MS, MO>;

    /// [`Eso`](super::Eso) with `E` present, `S` absent, `O` absent, see [shorthand module docs](super::x)
    pub type E<ME, MS, MO> =
        super::Eso<An<<ME as Maybe>::Inner>, No<<MS as Maybe>::Inner>, No<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` pass-through, `S` absent, `O` absent, see [shorthand module docs](super::x)
    pub type e<ME, MS, MO> = super::Eso<ME, No<<MS as Maybe>::Inner>, No<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` absent, `S` present, `O` absent, see [shorthand module docs](super::x)
    pub type S<ME, MS, MO> =
        super::Eso<No<<ME as Maybe>::Inner>, An<<MS as Maybe>::Inner>, No<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` absent, `S` pass-through, `O` absent, see [shorthand module docs](super::x)
    pub type s<ME, MS, MO> = super::Eso<No<<ME as Maybe>::Inner>, MS, No<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` absent, `S` absent, `O` present, see [shorthand module docs](super::x)
    pub type O<ME, MS, MO> =
        super::Eso<No<<ME as Maybe>::Inner>, No<<MS as Maybe>::Inner>, An<<MO as Maybe>::Inner>>;

    /// [`Eso`](super::Eso) with `E` absent, `S` absent, `O` pass-through, see [shorthand module docs](super::x)
    pub type o<ME, MS, MO> = super::Eso<No<<ME as Maybe>::Inner>, No<<MS as Maybe>::Inner>, MO>;

    /// [`Eso`](super::Eso) with `E` absent, `S` absent, `O` absent - this is [`Impossible`](crate::maybe::Impossible), see [shorthand module docs](super::x)
    pub type None<ME, MS, MO> =
        super::Eso<No<<ME as Maybe>::Inner>, No<<MS as Maybe>::Inner>, No<<MO as Maybe>::Inner>>;
}

/// Shorthand type aliases for transformations of an [`Eso`],
/// where the `E` and `S` parameters are equal.
///
/// This can be used to specify types that are never ephemeral.
///
/// The type names derive from the two remaining components `MS` and `MO`,
/// but the input type arguments are transformed according to the
/// rules:
///
/// | Rule      | Type parameter  | Transformed to | Meaning      |
/// |-----------|-----------------|----------------|--------------|
/// | Uppercase | `MT`: [`Maybe`] | `An<T::Inner>` | present      |
/// | Missing   | `MT`: [`Maybe`] | `No<T::Inner>` | absent       |
/// | Lowercase | `MT`: [`Maybe`] | `MT`           | pass-through |
#[allow(non_camel_case_types)]
pub mod s {
    use super::t;
    use crate::maybe::Maybe;

    /// [`Eso`](super::Eso) with `E` = `S` present, `O` present, see [shorthand module docs](super::s)
    pub type SO<S, O> = t::SO<S, S, O>;

    /// [`Eso`](super::Eso) with `E` = `S` pass-through, `O` present, see [shorthand module docs](super::s)
    pub type sO<MS, O> = t::sO<<MS as Maybe>::Inner, MS, O>;

    /// [`Eso`](super::Eso) with `E` = `S` present, `O` pass-through, see [shorthand module docs](super::s)
    pub type So<S, MO> = t::So<S, S, MO>;

    /// [`Eso`](super::Eso) with `E` = `S` pass-through, `O` pass-through, see [shorthand module docs](super::s)
    pub type so<MS, MO> = t::so<<MS as Maybe>::Inner, MS, MO>;

    /// [`Eso`](super::Eso) with `E` = `S` present, `O` absent, see [shorthand module docs](super::s)
    pub type S<S, O> = t::S<S, S, O>;

    /// [`Eso`](super::Eso) with `E` = `S` absent, `O` present, see [shorthand module docs](super::s)
    pub type O<S, O> = t::O<S, S, O>;

    /// [`Eso`](super::Eso) with `E` = `S` pass-through, `O` absent, see [shorthand module docs](super::s)
    pub type s<MS, O> = t::s<<MS as Maybe>::Inner, MS, O>;

    /// [`Eso`](super::Eso) with `E` = `S` absent, `O` pass-through, see [shorthand module docs](super::s)
    pub type o<S, MO> = t::o<S, S, MO>;

    /// [`Eso`](super::Eso) with `E` = `S` absent, `O` absent, see [shorthand module docs](super::s)
    pub type None<S, O> = t::None<S, S, O>;
}