Implement Debug for conn types
This commit is contained in:
parent
805df53699
commit
59eff03ae9
1 changed files with 19 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use std::result;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use std::{fmt, result};
|
||||
|
||||
use cove_core::packets::Packet;
|
||||
use futures::stream::{SplitSink, SplitStream};
|
||||
|
|
@ -35,6 +35,12 @@ pub struct ConnTx {
|
|||
tx: UnboundedSender<Message>,
|
||||
}
|
||||
|
||||
impl fmt::Debug for ConnTx {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("ConnTx").finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl ConnTx {
|
||||
pub fn send(&self, packet: &Packet) -> Result<()> {
|
||||
let msg = Message::Text(serde_json::to_string(packet)?);
|
||||
|
|
@ -48,6 +54,12 @@ pub struct ConnRx {
|
|||
last_ping_payload: Arc<Mutex<Vec<u8>>>,
|
||||
}
|
||||
|
||||
impl fmt::Debug for ConnRx {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("ConnRx").finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl ConnRx {
|
||||
pub async fn recv(&mut self) -> Result<Option<Packet>> {
|
||||
loop {
|
||||
|
|
@ -84,6 +96,12 @@ pub struct ConnMaintenance {
|
|||
last_ping_payload: Arc<Mutex<Vec<u8>>>,
|
||||
}
|
||||
|
||||
impl fmt::Debug for ConnMaintenance {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("ConnMaintenance").finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl ConnMaintenance {
|
||||
pub async fn perform(self) -> Result<()> {
|
||||
let result = try_join!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue