Skip to content

Commit e92adab

Browse files
committed
f Also fix docs for RGS --no-default-features
1 parent 5ee9a90 commit e92adab

File tree

1 file changed

+19
-5
lines changed
  • lightning-rapid-gossip-sync/src

1 file changed

+19
-5
lines changed

lightning-rapid-gossip-sync/src/lib.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,15 @@
3535
//! Note that the first ever rapid sync should use `0` for `last_sync_timestamp`.
3636
//!
3737
//! After the gossip data snapshot has been downloaded, one of the client's graph processing
38-
//! functions needs to be called. In this example, we process the update by reading its contents
39-
//! from disk, which we do by calling [`RapidGossipSync::update_network_graph`]:
38+
//! functions needs to be called.
39+
#![cfg_attr(
40+
feature = "std",
41+
doc = "In this example, we process the update by reading its contents from disk, which we do by calling [`RapidGossipSync::update_network_graph`]:"
42+
)]
43+
#![cfg_attr(
44+
not(feature = "std"),
45+
doc = "In this example, we process the update by reading its contents from disk, which we do by calling [`RapidGossipSync::update_network_graph_no_std`]:"
46+
)]
4047
//!
4148
//! ```
4249
//! use bitcoin::constants::genesis_block;
@@ -55,9 +62,16 @@
5562
//! let rapid_sync = RapidGossipSync::new(&network_graph, &logger);
5663
//! let snapshot_contents: &[u8] = &[0; 0];
5764
//! // In non-`std` environments you need to provide the current time in unix epoch seconds
58-
//! // otherwise you can use `update_network_graph`
59-
//! let current_time_unix = 0;
60-
//! let new_last_sync_timestamp_result = rapid_sync.update_network_graph_no_std(snapshot_contents, Some(current_time_unix));
65+
//! // otherwise you can use `update_network_graph`:
66+
#![cfg_attr(
67+
feature = "std",
68+
doc = "let new_last_sync_timestamp_result = rapid_sync.update_network_graph(snapshot_contents);"
69+
)]
70+
#![cfg_attr(not(feature = "std"), doc = "let current_time_unix = 0;")]
71+
#![cfg_attr(
72+
not(feature = "std"),
73+
doc = "let new_last_sync_timestamp_result = rapid_sync.update_network_graph_no_std(snapshot_contents, Some(current_time_unix));"
74+
)]
6175
//! ```
6276
6377
#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]

0 commit comments

Comments
 (0)