#[derive(Copy, Clone)] pub(crate) struct SpawnMeta<'a> { /// The name of the task #[cfg(all(tokio_unstable, feature = "tracing"))] pub(crate) name: Option<&'a str>, /// The original size of the future or function being spawned #[cfg(all(tokio_unstable, feature = "tracing"))] pub(crate) original_size: usize, /// The source code location where the task was spawned. /// /// This is wrapped in a type that may be empty when `tokio_unstable` is /// not enabled. pub(crate) spawned_at: crate::runtime::task::SpawnLocation,
_pd: PhantomData<&'a ()>,
}
impl<'a> SpawnMeta<'a> { /// Create new spawn meta with a name and original size (before possible auto-boxing) #[cfg(all(tokio_unstable, feature = "tracing"))] #[track_caller] pub(crate) fn new(name: Option<&'a str>, original_size: usize) -> Self { Self {
name,
original_size,
spawned_at: crate::runtime::task::SpawnLocation::capture(),
_pd: PhantomData,
}
}
/// Create a new unnamed spawn meta with the original size (before possible auto-boxing) #[track_caller] pub(crate) fn new_unnamed(original_size: usize) -> Self { #[cfg(not(all(tokio_unstable, feature = "tracing")))] let _original_size = original_size;
cfg_trace! { use core::{
pin::Pin,
task::{Context, Poll},
}; use pin_project_lite::pin_project; use std::mem; use std::future::Future; use tracing::instrument::Instrument; pub(crate) use tracing::instrument::Instrumented;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.