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

Replace manual Debug impl with educe in tor-circmgr

parent c1b80d65
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3155,6 +3155,7 @@ dependencies = [
 "async-trait",
 "bounded-vec-deque",
 "derive_builder",
 "educe",
 "futures",
 "futures-await-test",
 "humantime-serde",
@@ -3165,6 +3166,7 @@ dependencies = [
 "serde",
 "static_assertions",
 "thiserror",
 "tor-bytes",
 "tor-chanmgr",
 "tor-config",
 "tor-error",
+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ repository="https://gitlab.torproject.org/tpo/core/arti.git/"
experimental-api = []

[dependencies]
tor-bytes = { path = "../tor-bytes", version = "0.1.0"}
tor-chanmgr = { path="../tor-chanmgr", version = "0.1.0"}
tor-config = { path="../tor-config", version = "0.1.0"}
tor-error = { path="../tor-error", version = "0.1.0"}
@@ -33,6 +34,7 @@ tor-rtcompat = { path="../tor-rtcompat", version = "0.1.0"}
async-trait = "0.1.2"
bounded-vec-deque = "0.1"
derive_builder = "0.10"
educe = "0.4.6"
futures = "0.3.14"
humantime-serde = "1"
itertools = "0.10.1"
+5 −12
Original line number Diff line number Diff line
@@ -5,10 +5,11 @@ use crate::path::OwnedPath;
use crate::usage::{SupportedCircUsage, TargetCircUsage};
use crate::{DirInfo, Error, Result};
use async_trait::async_trait;
use educe::Educe;
use futures::future::OptionFuture;
use std::convert::TryInto;
use std::fmt::{self, Debug};
use std::sync::Arc;
use tor_bytes::skip_fmt;
use tor_error::internal;
use tor_proto::circuit::{CircParameters, ClientCirc};
use tor_rtcompat::Runtime;
@@ -25,6 +26,8 @@ impl mgr::AbstractCirc for tor_proto::circuit::ClientCirc {

/// The information generated by circuit planning, and used to build a
/// circuit.
#[derive(Educe)]
#[educe(Debug)]
pub(crate) struct Plan {
    /// The supported usage that the circuit will have when complete
    final_spec: SupportedCircUsage,
@@ -39,20 +42,10 @@ pub(crate) struct Plan {
    /// If this path is using a guard, we'll use this object to learn
    /// whether we're allowed to use the circuit or whether we have to
    /// wait a while.
    #[educe(Debug(method = "skip_fmt"))]
    guard_usable: Option<tor_guardmgr::GuardUsable>,
}

impl Debug for Plan {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.debug_struct("Plan")
            .field("final_spec", &self.final_spec)
            .field("path", &self.path)
            .field("params", &self.params)
            .field("guard_status", &self.guard_status)
            .finish_non_exhaustive()
    }
}

impl MockablePlan for Plan {}

#[async_trait]