Replace manual Debug impl with educe in arti-client
This commit is contained in:
parent
decdd05ec5
commit
1b8a8f933a
|
@ -127,6 +127,7 @@ dependencies = [
|
||||||
"derive_builder",
|
"derive_builder",
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"directories",
|
"directories",
|
||||||
|
"educe",
|
||||||
"futures",
|
"futures",
|
||||||
"humantime-serde",
|
"humantime-serde",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
@ -137,6 +138,7 @@ dependencies = [
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
|
"tor-bytes",
|
||||||
"tor-chanmgr",
|
"tor-chanmgr",
|
||||||
"tor-circmgr",
|
"tor-circmgr",
|
||||||
"tor-config",
|
"tor-config",
|
||||||
|
|
|
@ -28,6 +28,7 @@ error_detail = [ ]
|
||||||
experimental-api = []
|
experimental-api = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
tor-bytes = { path="../tor-bytes", version = "0.1.0"}
|
||||||
tor-circmgr = { path="../tor-circmgr", version = "0.1.0"}
|
tor-circmgr = { path="../tor-circmgr", version = "0.1.0"}
|
||||||
tor-config = { path="../tor-config", version = "0.1.0"}
|
tor-config = { path="../tor-config", version = "0.1.0"}
|
||||||
tor-chanmgr = { path="../tor-chanmgr", 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_builder = "0.10"
|
||||||
derive_more = "0.99"
|
derive_more = "0.99"
|
||||||
directories = "4"
|
directories = "4"
|
||||||
|
educe = "0.4.6"
|
||||||
futures = "0.3.14"
|
futures = "0.3.14"
|
||||||
postage = { version = "0.4", default-features = false, features = ["futures-traits"] }
|
postage = { version = "0.4", default-features = false, features = ["futures-traits"] }
|
||||||
tracing = "0.1.18"
|
tracing = "0.1.18"
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
use std::{borrow::Cow, fmt, time::SystemTime};
|
use std::{borrow::Cow, fmt, time::SystemTime};
|
||||||
|
|
||||||
use derive_more::Display;
|
use derive_more::Display;
|
||||||
|
use educe::Educe;
|
||||||
use futures::{Stream, StreamExt};
|
use futures::{Stream, StreamExt};
|
||||||
|
use tor_bytes::skip_fmt;
|
||||||
use tor_chanmgr::{ConnBlockage, ConnStatus, ConnStatusEvents};
|
use tor_chanmgr::{ConnBlockage, ConnStatus, ConnStatusEvents};
|
||||||
use tor_dirmgr::{DirBootstrapEvents, DirBootstrapStatus};
|
use tor_dirmgr::{DirBootstrapEvents, DirBootstrapStatus};
|
||||||
use tracing::debug;
|
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
|
// 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
|
// 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.
|
// `borrow()` and the postage::Stream trait) are extraneous to the API we want.
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Educe)]
|
||||||
|
#[educe(Debug)]
|
||||||
pub struct BootstrapEvents {
|
pub struct BootstrapEvents {
|
||||||
/// The receiver that implements this stream.
|
/// The receiver that implements this stream.
|
||||||
|
#[educe(Debug(method = "skip_fmt"))]
|
||||||
pub(crate) inner: postage::watch::Receiver<BootstrapStatus>,
|
pub(crate) inner: postage::watch::Receiver<BootstrapStatus>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 {
|
impl Stream for BootstrapEvents {
|
||||||
type Item = BootstrapStatus;
|
type Item = BootstrapStatus;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue