Skip to content

Commit ecf2322

Browse files
committed
f - Gate Future::wait_timeout doc links on std
Now that `get_async_receive_offer_ready_future` and `await_async_receive_offer` are available in no-std, their rustdoc intra-doc links to `Future::wait_timeout` (which is itself still std-only) break the no-std rustdoc build. Wrap the sentence and reference definition that mention `Future::wait_timeout` in `cfg_attr(feature = "std", doc = ...)` so the links only appear when they can resolve. Co-Authored-By: HAL 9000
1 parent 21e8600 commit ecf2322

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

lightning/src/ln/channelmanager.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5888,11 +5888,17 @@ impl<
58885888
/// protocol completes, or immediately if one is already available.
58895889
///
58905890
/// Callers that need a timeout can combine this future with their runtime's timeout
5891-
/// primitive. Synchronous callers should instead fetch the underlying [`Future`] via
5892-
/// [`Self::get_async_receive_offer_ready_future`] and call [`Future::wait_timeout`] on it.
5891+
/// primitive.
5892+
#[cfg_attr(
5893+
feature = "std",
5894+
doc = "Synchronous callers should instead fetch the underlying [`Future`] via [`Self::get_async_receive_offer_ready_future`] and call [`Future::wait_timeout`] on it."
5895+
)]
58935896
///
58945897
/// [`Future`]: crate::util::wakers::Future
5895-
/// [`Future::wait_timeout`]: crate::util::wakers::Future::wait_timeout
5898+
#[cfg_attr(
5899+
feature = "std",
5900+
doc = "[`Future::wait_timeout`]: crate::util::wakers::Future::wait_timeout"
5901+
)]
58965902
pub async fn await_async_receive_offer(&self) -> Result<Offer, ()> {
58975903
if let Ok(offer) = self.get_async_receive_offer() {
58985904
return Ok(offer);

lightning/src/offers/flow.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,9 +1724,13 @@ impl<MR: MessageRouter, L: Logger> OffersMessageFlow<MR, L> {
17241724
/// Returns a [`Future`] that completes when an async receive offer is ready, i.e., after the
17251725
/// interactive static-invoice protocol completes.
17261726
///
1727-
/// Callers can either `.await` the returned [`Future`] in an async context or call
1728-
/// [`Future::wait_timeout`] from a synchronous context. After it completes, use
1729-
/// [`Self::get_async_receive_offer`] to retrieve the offer.
1727+
/// Callers can `.await` the returned [`Future`] in an async context.
1728+
#[cfg_attr(
1729+
feature = "std",
1730+
doc = "Synchronous callers can instead call [`Future::wait_timeout`] on it."
1731+
)]
1732+
///
1733+
/// After it completes, use [`Self::get_async_receive_offer`] to retrieve the offer.
17301734
pub fn get_async_receive_offer_ready_future(&self) -> Future {
17311735
self.async_receive_offer_ready_notifier.get_future()
17321736
}

0 commit comments

Comments
 (0)