-
Notifications
You must be signed in to change notification settings - Fork 456
Expand file tree
/
Copy pathmod.rs
More file actions
107 lines (92 loc) · 2.74 KB
/
mod.rs
File metadata and controls
107 lines (92 loc) · 2.74 KB
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
// This file is Copyright its original authors, visible in version control
// history.
//
// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// You may not use this file except in accordance with one or both of these
// licenses.
//! Some utility modules live here. See individual sub-modules for more info.
#[macro_use]
pub(crate) mod fuzz_wrappers;
#[macro_use]
pub mod ser_macros;
#[cfg(any(test, feature = "_test_utils"))]
pub mod mut_global;
pub mod anchor_channel_reserves;
pub mod async_poll;
#[cfg(fuzzing)]
pub mod base32;
#[cfg(not(fuzzing))]
pub(crate) mod base32;
pub mod custom_message;
pub mod errors;
pub mod message_signing;
pub mod native_async;
pub mod persist;
pub mod scid_utils;
pub mod ser;
pub mod sweep;
pub mod wakers;
pub(crate) mod atomic_counter;
pub(crate) mod byte_utils;
pub mod hash_tables;
pub(crate) mod transaction_utils;
#[cfg(feature = "std")]
pub(crate) mod time;
pub mod indexed_map;
/// Logging macro utilities.
#[macro_use]
pub(crate) mod macro_logger;
// These have to come after macro_logger to build
pub mod config;
pub mod logger;
#[cfg(any(test, feature = "_test_utils"))]
pub mod test_utils;
/// impls of traits that add exra enforcement on the way they're called. Useful for detecting state
/// machine errors and used in fuzz targets and tests.
#[cfg(any(test, feature = "_test_utils"))]
pub mod test_channel_signer;
/// A macro to delegate trait implementations to a field of a struct.
///
/// For example:
/// ```ignore
/// use lightning::delegate;
/// delegate!(A, T, inner,
/// fn b(, c: u64) -> u64,
/// fn m(mut, d: u64) -> (),
/// fn o(, ) -> u64,
/// #[cfg(debug_assertions)]
/// fn t(,) -> (),
/// ;
/// type O = u64,
/// #[cfg(debug_assertions)]
/// type T = (),
/// );
/// ```
///
/// where T is the trait to be implemented, A is the struct
/// to implement the trait for, and inner is the field of A
/// to delegate the trait implementation to.
#[cfg(any(test, feature = "_test_utils"))]
macro_rules! delegate {
($N: ident, $T: ident, $ref: ident,
$($(#[$fpat: meta])? fn $f: ident($($mu: ident)?, $($n: ident: $t: ty),*) -> $r: ty),* $(,)?
$(;$($(#[$tpat: meta])? type $TN: ident = $TT: ty),*)? $(,)?
) => {
impl $T for $N {
$(
$(#[$fpat])?
fn $f(&$($mu)? self, $($n: $t),*) -> $r {
$T::$f(&$($mu)? *self.$ref, $($n),*)
}
)*
$($(
$(#[$tpat])?
type $TN = $TT;
)*)?
}
};
}
#[cfg(any(test, feature = "_test_utils"))]
pub mod dyn_signer;