macros: render more comprehensible documentation for try_join! (#6841)

Signed-off-by: Rustin170506 <[email protected]>
This commit is contained in:
Rustin
2024-09-14 11:34:45 +02:00
committed by GitHub
parent a2496548d1
commit 83e922f051
+14 -2
View File
@@ -1,3 +1,5 @@
macro_rules! doc {
($try_join:item) => {
/// Waits on multiple concurrent branches, returning when **all** branches /// Waits on multiple concurrent branches, returning when **all** branches
/// complete with `Ok(_)` or on the first `Err(_)`. /// complete with `Ok(_)` or on the first `Err(_)`.
/// ///
@@ -100,7 +102,17 @@
/// ``` /// ```
#[macro_export] #[macro_export]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))] #[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
macro_rules! try_join { $try_join
};
}
#[cfg(doc)]
doc! {macro_rules! try_join {
($($future:expr),*) => { unimplemented!() }
}}
#[cfg(not(doc))]
doc! {macro_rules! try_join {
(@ { (@ {
// One `_` for each branch in the `try_join!` macro. This is not used once // One `_` for each branch in the `try_join!` macro. This is not used once
// normalization is complete. // normalization is complete.
@@ -215,4 +227,4 @@ macro_rules! try_join {
}; };
() => { async { Ok(()) }.await } () => { async { Ok(()) }.await }
} }}