Skip to content

Commit 2750f10

Browse files
committed
Implement Debug for some items
1 parent a70959e commit 2750f10

File tree

5 files changed

+29
-1
lines changed

5 files changed

+29
-1
lines changed

embassy/src/embassy_sunset.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub type SunsetRawMutex = NoopRawMutex;
3131

3232
pub type SunsetMutex<T> = Mutex<SunsetRawMutex, T>;
3333

34+
#[derive(Debug)]
3435
struct Wakers {
3536
chan_read: [WakerRegistration; MAX_CHANNELS],
3637

@@ -109,6 +110,18 @@ pub(crate) struct EmbassySunset<'a> {
109110
chan_refcounts: [AtomicUsize; MAX_CHANNELS],
110111
}
111112

113+
impl core::fmt::Debug for EmbassySunset<'_> {
114+
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
115+
let mut d = f.debug_struct("EmbassySunset");
116+
if let Ok(i) = self.inner.try_lock() {
117+
d.field("runner", &i.runner);
118+
} else {
119+
d.field("inner", &"(locked)");
120+
}
121+
d.finish_non_exhaustive()
122+
}
123+
}
124+
112125
impl<'a> EmbassySunset<'a> {
113126
pub fn new(runner: Runner<'a>) -> Self {
114127
let wakers = Wakers {

embassy/src/server.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use embassy_sunset::{EmbassySunset, ProgressHolder};
1414
/// and [`stdio_stderr()`][Self::stdio_stderr] methods.
1515
///
1616
/// This is async executor agnostic.
17+
#[derive(Debug)]
1718
pub struct SSHServer<'a> {
1819
sunset: EmbassySunset<'a>,
1920
}

src/event.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ pub(crate) enum CliEventId {
214214
Banner,
215215
#[allow(unused)]
216216
Defunct,
217-
218217
// TODO:
219218
// Disconnected
220219
// OpenTCPForwarded (new session)

src/kex.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const fixed_options_cipher: &[&str] = &[SSH_NAME_CHAPOLY, SSH_NAME_AES256_CTR];
5454
const fixed_options_mac: &[&str] = &[SSH_NAME_HMAC_SHA256];
5555
const fixed_options_comp: &[&str] = &[SSH_NAME_NONE];
5656

57+
#[derive(Debug)]
5758
pub(crate) struct AlgoConfig {
5859
kexs: LocalNames,
5960
hostsig: LocalNames,

src/traffic.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use core::fmt;
2+
13
#[allow(unused_imports)]
24
use {
35
crate::error::{Error, Result},
@@ -89,6 +91,18 @@ enum RxState {
8991
},
9092
}
9193

94+
impl core::fmt::Debug for TrafIn<'_> {
95+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
96+
f.debug_struct("TrafIn").field("state", &self.state).finish_non_exhaustive()
97+
}
98+
}
99+
100+
impl core::fmt::Debug for TrafOut<'_> {
101+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
102+
f.debug_struct("TrafOut").field("state", &self.state).finish_non_exhaustive()
103+
}
104+
}
105+
92106
impl<'a> TrafIn<'a> {
93107
pub fn new(buf: &'a mut [u8]) -> Self {
94108
Self { buf, state: RxState::Idle }

0 commit comments

Comments
 (0)