Skip to content

Commit 793c777

Browse files
committed
make BackgroundProcessorConfig docs conditional on futures feature
1 parent 5534915 commit 793c777

File tree

1 file changed

+14
-13
lines changed
  • lightning-background-processor/src

1 file changed

+14
-13
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ use lightning_liquidity::ALiquidityManager;
5151

5252
use core::ops::Deref;
5353
use core::time::Duration;
54+
#[cfg(feature = "std")]
55+
use std::marker::PhantomData;
5456

5557
#[cfg(feature = "std")]
5658
use core::sync::atomic::{AtomicBool, Ordering};
@@ -64,9 +66,6 @@ use std::time::Instant;
6466
#[cfg(not(feature = "std"))]
6567
use alloc::boxed::Box;
6668

67-
#[cfg(feature = "std")]
68-
use std::marker::PhantomData;
69-
7069
/// `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
7170
/// Rust-Lightning running properly, and (2) either can or should be run in the background. Its
7271
/// responsibilities are:
@@ -1133,7 +1132,7 @@ impl BackgroundProcessor {
11331132
K: 'static + Deref,
11341133
OS: 'static + Deref<Target = OutputSweeperSync<T, D, F, CF, K, L, O>> + Send,
11351134
>(
1136-
config: BackgroundProcessorConfig<
1135+
#[rustfmt::skip] config: BackgroundProcessorConfig<
11371136
'a,
11381137
UL,
11391138
CF,
@@ -1238,7 +1237,7 @@ impl BackgroundProcessor {
12381237
/// including required components (like the channel manager and peer manager) and optional
12391238
/// components (like the liquidity_manager, sweeper, onion messenger and scorer).
12401239
///
1241-
/// The configuration can be constructed using [`BackgroundProcessorBuilder`], which provides
1240+
/// The configuration can be constructed using [`BackgroundProcessorConfigBuilder`], which provides
12421241
/// a convenient builder pattern for setting up both required and optional components.
12431242
///
12441243
/// This same configuration can be used for Creating a [`BackgroundProcessor`] via [`BackgroundProcessor::from_config`]
@@ -1300,13 +1299,13 @@ pub struct BackgroundProcessorConfig<
13001299
_phantom: PhantomData<(&'a (), CF, T, F, P)>,
13011300
}
13021301

1303-
/// A builder for constructing a [`BackgroundProcessor`] with optional components.
1302+
/// A builder for constructing a [`BackgroundProcessorConfig`] with optional components.
13041303
///
1305-
/// This builder provides a flexible and type-safe way to construct a [`BackgroundProcessor`]
1304+
/// This builder provides a flexible and type-safe way to construct a [`BackgroundProcessorConfig`]
13061305
/// with optional components like `onion_messenger` and `scorer`. It helps avoid specifying
13071306
/// concrete types for components that aren't being used.
13081307
#[cfg(feature = "std")]
1309-
pub struct BackgroundProcessorBuilder<
1308+
pub struct BackgroundProcessorConfigBuilder<
13101309
'a,
13111310
UL: 'static + Deref,
13121311
CF: 'static + Deref,
@@ -1392,7 +1391,7 @@ impl<
13921391
K: 'static + Deref,
13931392
OS: 'static + Deref<Target = OutputSweeperSync<T, D, F, CF, K, L, O>> + Send,
13941393
>
1395-
BackgroundProcessorBuilder<
1394+
BackgroundProcessorConfigBuilder<
13961395
'a,
13971396
UL,
13981397
CF,
@@ -1531,7 +1530,9 @@ impl Drop for BackgroundProcessor {
15311530

15321531
#[cfg(all(feature = "std", test))]
15331532
mod tests {
1534-
use super::{BackgroundProcessor, BackgroundProcessorBuilder, GossipSync, FRESHNESS_TIMER};
1533+
use super::{
1534+
BackgroundProcessor, BackgroundProcessorConfigBuilder, GossipSync, FRESHNESS_TIMER,
1535+
};
15351536
use bitcoin::constants::{genesis_block, ChainHash};
15361537
use bitcoin::hashes::Hash;
15371538
use bitcoin::locktime::absolute::LockTime;
@@ -3248,11 +3249,11 @@ mod tests {
32483249
}
32493250

32503251
#[test]
3251-
fn test_background_processor_builder() {
3252+
fn test_background_processor_config_builder() {
32523253
// Test that when a new channel is created, the ChannelManager needs to be re-persisted with
32533254
// updates. Also test that when new updates are available, the manager signals that it needs
32543255
// re-persistence and is successfully re-persisted.
3255-
let (persist_dir, nodes) = create_nodes(2, "test_background_processor_builder");
3256+
let (persist_dir, nodes) = create_nodes(2, "test_background_processor_config_builder");
32563257

32573258
// Go through the channel creation process so that each node has something to persist. Since
32583259
// open_channel consumes events, it must complete before starting BackgroundProcessor to
@@ -3263,7 +3264,7 @@ mod tests {
32633264
let data_dir = nodes[0].kv_store.get_data_dir();
32643265
let persister = Arc::new(Persister::new(data_dir));
32653266
let event_handler = |_: _| Ok(());
3266-
let mut builder = BackgroundProcessorBuilder::new(
3267+
let mut builder = BackgroundProcessorConfigBuilder::new(
32673268
persister,
32683269
event_handler,
32693270
nodes[0].chain_monitor.clone(),

0 commit comments

Comments
 (0)