diff --git a/src/lib.rs b/src/lib.rs index 23d02cd..f80fa08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,9 @@ +#![warn( + missing_debug_implementations, + missing_docs, + rust_2018_idioms, + unreachable_pub +)] #![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(docsrs, allow(unused_attributes))] diff --git a/src/runtime.rs b/src/runtime.rs index 282f3f7..677feb6 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -1218,6 +1218,7 @@ impl Iterator for RuntimeIntervals { } impl RuntimeMonitor { + /// Creates a new [`RuntimeMonitor`]. pub fn new(runtime: &runtime::Handle) -> RuntimeMonitor { let runtime = runtime.metrics(); @@ -1435,6 +1436,7 @@ impl Worker { } impl RuntimeMetrics { + /// Returns the ratio of the [`RuntimeMetrics::total_polls_count`] to the [`RuntimeMetrics::total_noop_count`]. pub fn mean_polls_per_park(&self) -> f64 { let total_park_count = self.total_park_count - self.total_noop_count; if total_park_count == 0 { @@ -1444,6 +1446,7 @@ impl RuntimeMetrics { } } + /// Returns the ratio of the [`RuntimeMetrics::total_busy_duration`] to the [`RuntimeMetrics::elapsed`]. pub fn busy_ratio(&self) -> f64 { self.total_busy_duration.as_nanos() as f64 / self.elapsed.as_nanos() as f64 } diff --git a/src/task.rs b/src/task.rs index 1270376..fd9726e 100644 --- a/src/task.rs +++ b/src/task.rs @@ -523,6 +523,7 @@ pub struct TaskMonitorBuilder { } impl TaskMonitorBuilder { + /// Creates a new [`TaskMonitorBuilder`]. pub fn new() -> Self { Self { slow_poll_threshold: None, @@ -2440,9 +2441,9 @@ impl Stream for Instrumented { } fn instrument_poll( - cx: &mut Context, + cx: &mut Context<'_>, instrumented: Pin<&mut Instrumented>, - poll_fn: impl FnOnce(Pin<&mut T>, &mut Context) -> Poll, + poll_fn: impl FnOnce(Pin<&mut T>, &mut Context<'_>) -> Poll, ) -> Poll { let poll_start = Instant::now(); let this = instrumented.project();