runtime: fix stability feature flags for docs (#6909)

This commit is contained in:
Josh McKinney
2024-10-22 11:19:57 +02:00
committed by GitHub
parent fbfeb9a68a
commit 92ccadeb3c
6 changed files with 27 additions and 4 deletions
+3 -1
View File
@@ -351,8 +351,10 @@
//! - [`task::Builder`] //! - [`task::Builder`]
//! - Some methods on [`task::JoinSet`] //! - Some methods on [`task::JoinSet`]
//! - [`runtime::RuntimeMetrics`] //! - [`runtime::RuntimeMetrics`]
//! - [`runtime::Builder::on_task_spawn`]
//! - [`runtime::Builder::on_task_terminate`]
//! - [`runtime::Builder::unhandled_panic`] //! - [`runtime::Builder::unhandled_panic`]
//! - [`task::Id`] //! - [`runtime::TaskMeta`]
//! //!
//! This flag enables **unstable** features. The public API of these features //! This flag enables **unstable** features. The public API of these features
//! may break in 1.x releases. To enable these features, the `--cfg //! may break in 1.x releases. To enable these features, the `--cfg
+14
View File
@@ -706,6 +706,12 @@ impl Builder {
/// ///
/// This *does not* support [`LocalSet`](crate::task::LocalSet) at this time. /// This *does not* support [`LocalSet`](crate::task::LocalSet) at this time.
/// ///
/// **Note**: This is an [unstable API][unstable]. The public API of this type
/// may break in 1.x releases. See [the documentation on unstable
/// features][unstable] for details.
///
/// [unstable]: crate#unstable-features
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
@@ -728,6 +734,7 @@ impl Builder {
/// # } /// # }
/// ``` /// ```
#[cfg(all(not(loom), tokio_unstable))] #[cfg(all(not(loom), tokio_unstable))]
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
pub fn on_task_spawn<F>(&mut self, f: F) -> &mut Self pub fn on_task_spawn<F>(&mut self, f: F) -> &mut Self
where where
F: Fn(&TaskMeta<'_>) + Send + Sync + 'static, F: Fn(&TaskMeta<'_>) + Send + Sync + 'static,
@@ -748,6 +755,12 @@ impl Builder {
/// ///
/// This *does not* support [`LocalSet`](crate::task::LocalSet) at this time. /// This *does not* support [`LocalSet`](crate::task::LocalSet) at this time.
/// ///
/// **Note**: This is an [unstable API][unstable]. The public API of this type
/// may break in 1.x releases. See [the documentation on unstable
/// features][unstable] for details.
///
/// [unstable]: crate#unstable-features
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
@@ -770,6 +783,7 @@ impl Builder {
/// # } /// # }
/// ``` /// ```
#[cfg(all(not(loom), tokio_unstable))] #[cfg(all(not(loom), tokio_unstable))]
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
pub fn on_task_terminate<F>(&mut self, f: F) -> &mut Self pub fn on_task_terminate<F>(&mut self, f: F) -> &mut Self
where where
F: Fn(&TaskMeta<'_>) + Send + Sync + 'static, F: Fn(&TaskMeta<'_>) + Send + Sync + 'static,
+3 -2
View File
@@ -384,8 +384,9 @@ cfg_rt! {
mod task_hooks; mod task_hooks;
pub(crate) use task_hooks::{TaskHooks, TaskCallback}; pub(crate) use task_hooks::{TaskHooks, TaskCallback};
#[cfg(tokio_unstable)] cfg_unstable! {
pub use task_hooks::TaskMeta; pub use task_hooks::TaskMeta;
}
#[cfg(not(tokio_unstable))] #[cfg(not(tokio_unstable))]
pub(crate) use task_hooks::TaskMeta; pub(crate) use task_hooks::TaskMeta;
+1
View File
@@ -119,6 +119,7 @@ pub enum RuntimeFlavor {
MultiThread, MultiThread,
/// The flavor that executes tasks across multiple threads. /// The flavor that executes tasks across multiple threads.
#[cfg(tokio_unstable)] #[cfg(tokio_unstable)]
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
MultiThreadAlt, MultiThreadAlt,
} }
-1
View File
@@ -391,7 +391,6 @@ impl<S: 'static> Task<S> {
/// ///
/// [task ID]: crate::task::Id /// [task ID]: crate::task::Id
#[cfg(tokio_unstable)] #[cfg(tokio_unstable)]
#[cfg_attr(docsrs, doc(cfg(tokio_unstable)))]
pub(crate) fn id(&self) -> crate::task::Id { pub(crate) fn id(&self) -> crate::task::Id {
// Safety: The header pointer is valid. // Safety: The header pointer is valid.
unsafe { Header::get_id(self.raw.header_ptr()) } unsafe { Header::get_id(self.raw.header_ptr()) }
+6
View File
@@ -15,6 +15,12 @@ pub(crate) struct TaskHooks {
} }
/// Task metadata supplied to user-provided hooks for task events. /// Task metadata supplied to user-provided hooks for task events.
///
/// **Note**: This is an [unstable API][unstable]. The public API of this type
/// may break in 1.x releases. See [the documentation on unstable
/// features][unstable] for details.
///
/// [unstable]: crate#unstable-features
#[allow(missing_debug_implementations)] #[allow(missing_debug_implementations)]
#[cfg_attr(not(tokio_unstable), allow(unreachable_pub))] #[cfg_attr(not(tokio_unstable), allow(unreachable_pub))]
pub struct TaskMeta<'a> { pub struct TaskMeta<'a> {