Replace manual Debug impl with educe in tor-chanmgr
This commit is contained in:
parent
1c44dfa595
commit
f467f4666e
|
@ -3124,6 +3124,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"derive_more",
|
"derive_more",
|
||||||
|
"educe",
|
||||||
"float_eq",
|
"float_eq",
|
||||||
"futures",
|
"futures",
|
||||||
"futures-await-test",
|
"futures-await-test",
|
||||||
|
@ -3131,6 +3132,7 @@ dependencies = [
|
||||||
"postage",
|
"postage",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
"tor-bytes",
|
||||||
"tor-error",
|
"tor-error",
|
||||||
"tor-linkspec",
|
"tor-linkspec",
|
||||||
"tor-llcrypto",
|
"tor-llcrypto",
|
||||||
|
|
|
@ -13,6 +13,7 @@ repository="https://gitlab.torproject.org/tpo/core/arti.git/"
|
||||||
[features]
|
[features]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
tor-bytes = { path="../tor-bytes", version = "0.1.0"}
|
||||||
tor-error = { path="../tor-error", version = "0.1.0"}
|
tor-error = { path="../tor-error", version = "0.1.0"}
|
||||||
tor-rtcompat = { path="../tor-rtcompat", version = "0.1.0"}
|
tor-rtcompat = { path="../tor-rtcompat", version = "0.1.0"}
|
||||||
tor-proto = { path="../tor-proto", version = "0.1.0"}
|
tor-proto = { path="../tor-proto", version = "0.1.0"}
|
||||||
|
@ -21,6 +22,7 @@ tor-llcrypto = { path="../tor-llcrypto", version = "0.1.0"}
|
||||||
|
|
||||||
async-trait = "0.1.2"
|
async-trait = "0.1.2"
|
||||||
derive_more = "0.99"
|
derive_more = "0.99"
|
||||||
|
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"] }
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
//! Code for exporting events from the channel manager.
|
//! Code for exporting events from the channel manager.
|
||||||
#![allow(dead_code, unreachable_pub)]
|
#![allow(dead_code, unreachable_pub)]
|
||||||
|
|
||||||
|
use educe::Educe;
|
||||||
use futures::{Stream, StreamExt};
|
use futures::{Stream, StreamExt};
|
||||||
use postage::watch;
|
use postage::watch;
|
||||||
use std::{
|
use std::{
|
||||||
fmt,
|
fmt,
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
|
use tor_bytes::skip_fmt;
|
||||||
|
|
||||||
/// The status of our connection to the internet.
|
/// The status of our connection to the internet.
|
||||||
#[derive(Default, Debug, Clone)]
|
#[derive(Default, Debug, Clone)]
|
||||||
|
@ -122,21 +124,17 @@ impl fmt::Display for ConnStatus {
|
||||||
/// Note that the bootstrap status is not monotonic: we might become less
|
/// Note that the bootstrap status is not monotonic: we might become less
|
||||||
/// bootstrapped than we were before. (For example, the internet could go
|
/// bootstrapped than we were before. (For example, the internet could go
|
||||||
/// down.)
|
/// down.)
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Educe)]
|
||||||
|
#[educe(Debug)]
|
||||||
pub struct ConnStatusEvents {
|
pub struct ConnStatusEvents {
|
||||||
/// The receiver that implements this stream.
|
/// The receiver that implements this stream.
|
||||||
///
|
///
|
||||||
/// (We wrap it in a new type here so that we can replace the implementation
|
/// (We wrap it in a new type here so that we can replace the implementation
|
||||||
/// later on if we need to.)
|
/// later on if we need to.)
|
||||||
|
#[educe(Debug(method = "skip_fmt"))]
|
||||||
inner: watch::Receiver<ConnStatus>,
|
inner: watch::Receiver<ConnStatus>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for ConnStatusEvents {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
f.debug_struct("ConnStatusEvents").finish_non_exhaustive()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Stream for ConnStatusEvents {
|
impl Stream for ConnStatusEvents {
|
||||||
type Item = ConnStatus;
|
type Item = ConnStatus;
|
||||||
fn poll_next(
|
fn poll_next(
|
||||||
|
|
Loading…
Reference in New Issue