///
/// The following example would extract the first B.
///
+/// ```ignore
/// enum Enum {
/// A(u8),
/// B(u16)
/// let elements = vec![Enum::A(1), Enum::A(2), Enum::B(3), Enum::A(4)];
///
/// assert_eq!(find_extract!(elements.iter(), Enum::B(x), x), Some(3u16));
+/// ```
macro_rules! find_extract {
($iter:expr, $enm:pat, $enm_var:ident) => {
find_all_extract!($iter, $enm, $enm_var).next()
///
/// The following example would extract all A.
///
+/// ```ignore
/// enum Enum {
/// A(u8),
/// B(u16)
/// find_all_extract!(elements.iter(), Enum::A(x), x).collect::<Vec<u8>>(),
/// vec![1u8, 2u8, 4u8]
/// );
+/// ```
macro_rules! find_all_extract {
($iter:expr, $enm:pat, $enm_var:ident) => {
$iter.filter_map(|tf| match *tf {
self.signed_invoice.amount_pico_btc().map(|v| v / 10)
}
- /// Returns the amount if specified in the invoice as pico <currency>.
+ /// Returns the amount if specified in the invoice as pico BTC.
fn amount_pico_btc(&self) -> Option<u64> {
self.signed_invoice.amount_pico_btc()
}
/// In order to avoid having to concern ourselves with standardness during the closing process, we
/// simply require our counterparty to use a dust limit which will leave any segwit output
/// standard.
-/// See https://github.com/lightning/bolts/issues/905 for more details.
+/// See <https://github.com/lightning/bolts/issues/905> for more details.
pub const MIN_CHAN_DUST_LIMIT_SATOSHIS: u64 = 354;
// Just a reasonable implementation-specific safe lower bound, higher than the dust limit.
/// `PaymentPathFailed` events with `all_paths_failed` can be pending at once, confusing a
/// downstream event handler as to when a payment has actually failed.
///
- /// (1) https://github.com/lightningdevkit/rust-lightning/issues/1164
+ /// (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
Abandoned {
session_privs: HashSet<[u8; 32]>,
payment_hash: PaymentHash,
}
}
-/// A simple wrapper that optionally prints " from <pubkey>" for an optional pubkey.
+/// A simple wrapper that optionally prints ` from <pubkey>` for an optional pubkey.
/// This works around `format!()` taking a reference to each argument, preventing
/// `if let Some(node_id) = peer.their_node_id { format!(.., node_id) } else { .. }` from compiling
/// due to lifetime errors.
}
/// A function used to filter out local or private addresses
-/// https://www.iana.org./assignments/ipv4-address-space/ipv4-address-space.xhtml
-/// https://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xhtml
+/// <https://www.iana.org./assignments/ipv4-address-space/ipv4-address-space.xhtml>
+/// <https://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xhtml>
fn filter_addresses(ip_address: Option<NetAddress>) -> Option<NetAddress> {
match ip_address{
// For IPv4 range 10.0.0.0 - 10.255.255.255 (10/8)