diff --git a/Cargo.lock b/Cargo.lock index 623f38277..1c42c19b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -127,6 +127,7 @@ dependencies = [ "derive_builder", "derive_more", "directories", + "educe", "futures", "humantime-serde", "once_cell", @@ -137,6 +138,7 @@ dependencies = [ "thiserror", "tokio", "tokio-util", + "tor-bytes", "tor-chanmgr", "tor-circmgr", "tor-config", diff --git a/crates/arti-client/Cargo.toml b/crates/arti-client/Cargo.toml index 3414b8188..d846e014f 100644 --- a/crates/arti-client/Cargo.toml +++ b/crates/arti-client/Cargo.toml @@ -28,6 +28,7 @@ error_detail = [ ] experimental-api = [] [dependencies] +tor-bytes = { path="../tor-bytes", version = "0.1.0"} tor-circmgr = { path="../tor-circmgr", version = "0.1.0"} tor-config = { path="../tor-config", version = "0.1.0"} tor-chanmgr = { path="../tor-chanmgr", version = "0.1.0"} @@ -41,6 +42,7 @@ humantime-serde = "1" derive_builder = "0.10" derive_more = "0.99" directories = "4" +educe = "0.4.6" futures = "0.3.14" postage = { version = "0.4", default-features = false, features = ["futures-traits"] } tracing = "0.1.18" diff --git a/crates/arti-client/src/status.rs b/crates/arti-client/src/status.rs index 30480117e..57a868705 100644 --- a/crates/arti-client/src/status.rs +++ b/crates/arti-client/src/status.rs @@ -4,7 +4,9 @@ use std::{borrow::Cow, fmt, time::SystemTime}; use derive_more::Display; +use educe::Educe; use futures::{Stream, StreamExt}; +use tor_bytes::skip_fmt; use tor_chanmgr::{ConnBlockage, ConnStatus, ConnStatusEvents}; use tor_dirmgr::{DirBootstrapEvents, DirBootstrapStatus}; use tracing::debug; @@ -189,20 +191,14 @@ pub(crate) async fn report_status( // implementation type. We do that because we might want to change the type in // the future, and because some of the functionality exposed by Receiver (like // `borrow()` and the postage::Stream trait) are extraneous to the API we want. -#[derive(Clone)] +#[derive(Clone, Educe)] +#[educe(Debug)] pub struct BootstrapEvents { /// The receiver that implements this stream. + #[educe(Debug(method = "skip_fmt"))] pub(crate) inner: postage::watch::Receiver, } -// We can't derive(Debug) since postage::watch::Receiver doesn't implement -// Debug. -impl std::fmt::Debug for BootstrapEvents { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("BootstrapEvents").finish_non_exhaustive() - } -} - impl Stream for BootstrapEvents { type Item = BootstrapStatus;