1 | // Copyright 2016-2024 Brian Smith. |
2 | // |
3 | // Permission to use, copy, modify, and/or distribute this software for any |
4 | // purpose with or without fee is hereby granted, provided that the above |
5 | // copyright notice and this permission notice appear in all copies. |
6 | // |
7 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES |
8 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
9 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY |
10 | // SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
11 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
12 | // OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
13 | // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
14 | |
15 | //! Error reporting. |
16 | |
17 | pub use self::{key_rejected::KeyRejected, unspecified::Unspecified}; |
18 | |
19 | pub(crate) use self::{ |
20 | input_too_long::InputTooLongError, len_mismatch_error::LenMismatchError, |
21 | too_much_output_requested::TooMuchOutputRequestedError, |
22 | }; |
23 | |
24 | mod input_too_long; |
25 | mod into_unspecified; |
26 | mod key_rejected; |
27 | mod unspecified; |
28 | |
29 | #[cold ] |
30 | #[inline (never)] |
31 | pub(crate) fn erase<T>(_: T) -> Unspecified { |
32 | Unspecified |
33 | } |
34 | |
35 | cold_exhaustive_error! { |
36 | struct too_much_output_requested::TooMuchOutputRequestedError |
37 | with pub(crate) constructor { |
38 | // Note that this might not actually be the (exact) output length |
39 | // requested, and its units might be lost. For example, it could be any of |
40 | // the following: |
41 | // |
42 | // * The length in bytes of the entire output. |
43 | // * The length in bytes of some *part* of the output. |
44 | // * A bit length. |
45 | // * A length in terms of "blocks" or other grouping of output values. |
46 | // * Some intermediate quantity that was used when checking the output |
47 | // length. |
48 | // * Some arbitrary value. |
49 | imprecise_output_length: usize |
50 | } |
51 | } |
52 | |
53 | cold_exhaustive_error! { |
54 | struct len_mismatch_error::LenMismatchError |
55 | with pub(crate) constructor { |
56 | len: usize |
57 | } |
58 | } |
59 | |