Skip to content

Commit 08964d8

Browse files
committed
Add example for progress logging
1 parent 9ae99d5 commit 08964d8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

timely/src/logging.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ pub trait ProgressEventTimestamp: std::fmt::Debug + std::any::Any {
7777
/// Upcasts this `ProgressEventTimestamp` to `Any`.
7878
///
7979
/// NOTE: This is required until https://github.com/rust-lang/rfcs/issues/2765 is fixed
80+
///
81+
/// # Example
82+
/// ```rust
83+
/// let ts = vec![(0usize, 0usize, (23u64, 10u64), -4i64), (0usize, 0usize, (23u64, 11u64), 1i64)];
84+
/// let ts: &timely::logging::ProgressEventTimestampVec = &ts;
85+
/// for (n, p, t, d) in ts.iter() {
86+
/// print!("{:?}, ", (n, p, t.as_any().downcast_ref::<(u64, u64)>(), d));
87+
/// }
88+
/// println!();
89+
/// ```
8090
fn as_any(&self) -> &dyn std::any::Any;
8191

8292
/// Returns the name of the concrete type of this object.

0 commit comments

Comments
 (0)