Commit f467f466 authored by Ian Jackson's avatar Ian Jackson
Browse files

Replace manual Debug impl with educe in tor-chanmgr

parent 1c44dfa5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3124,6 +3124,7 @@ version = "0.1.0"
dependencies = [
 "async-trait",
 "derive_more",
 "educe",
 "float_eq",
 "futures",
 "futures-await-test",
@@ -3131,6 +3132,7 @@ dependencies = [
 "postage",
 "rand 0.8.5",
 "thiserror",
 "tor-bytes",
 "tor-error",
 "tor-linkspec",
 "tor-llcrypto",
+2 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ repository="https://gitlab.torproject.org/tpo/core/arti.git/"
[features]

[dependencies]
tor-bytes = { path="../tor-bytes", version = "0.1.0"}
tor-error = { path="../tor-error", version = "0.1.0"}
tor-rtcompat = { path="../tor-rtcompat", 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"
derive_more = "0.99"
educe = "0.4.6"
futures = "0.3.14"
postage = { version = "0.4", default-features = false, features = ["futures-traits"] }
rand = "0.8"
+5 −7
Original line number Diff line number Diff line
//! Code for exporting events from the channel manager.
#![allow(dead_code, unreachable_pub)]

use educe::Educe;
use futures::{Stream, StreamExt};
use postage::watch;
use std::{
    fmt,
    time::{Duration, Instant},
};
use tor_bytes::skip_fmt;

/// The status of our connection to the internet.
#[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
/// bootstrapped than we were before.  (For example, the internet could go
/// down.)
#[derive(Clone)]
#[derive(Clone, Educe)]
#[educe(Debug)]
pub struct ConnStatusEvents {
    /// The receiver that implements this stream.
    ///
    /// (We wrap it in a new type here so that we can replace the implementation
    /// later on if we need to.)
    #[educe(Debug(method = "skip_fmt"))]
    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 {
    type Item = ConnStatus;
    fn poll_next(