tor-circmgr: impl Display for TargetPort

This will be used for error handling, and perhaps other things.
This commit is contained in:
Ian Jackson 2022-01-26 18:39:07 +00:00
parent 5edd031b97
commit a7e6caa731
1 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,7 @@
use rand::Rng;
use serde::{Deserialize, Serialize};
use std::fmt::{self, Display};
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::Arc;
use tracing::debug;
@ -59,6 +60,12 @@ impl TargetPort {
}
}
impl Display for TargetPort {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}{}", self.port, if self.ipv6 { "v6" } else { "v4" })
}
}
/// A token used to isolate unrelated streams on different circuits.
///
/// When two streams are associated with different isolation tokens, they