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::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
use std::{fmt, result};
|
||||||
|
|
||||||
use cove_core::packets::Packet;
|
use cove_core::packets::Packet;
|
||||||
use futures::stream::{SplitSink, SplitStream};
|
use futures::stream::{SplitSink, SplitStream};
|
||||||
|
|
@ -35,6 +35,12 @@ pub struct ConnTx {
|
||||||
tx: UnboundedSender<Message>,
|
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 {
|
impl ConnTx {
|
||||||
pub fn send(&self, packet: &Packet) -> Result<()> {
|
pub fn send(&self, packet: &Packet) -> Result<()> {
|
||||||
let msg = Message::Text(serde_json::to_string(packet)?);
|
let msg = Message::Text(serde_json::to_string(packet)?);
|
||||||
|
|
@ -48,6 +54,12 @@ pub struct ConnRx {
|
||||||
last_ping_payload: Arc<Mutex<Vec<u8>>>,
|
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 {
|
impl ConnRx {
|
||||||
pub async fn recv(&mut self) -> Result<Option<Packet>> {
|
pub async fn recv(&mut self) -> Result<Option<Packet>> {
|
||||||
loop {
|
loop {
|
||||||
|
|
@ -84,6 +96,12 @@ pub struct ConnMaintenance {
|
||||||
last_ping_payload: Arc<Mutex<Vec<u8>>>,
|
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 {
|
impl ConnMaintenance {
|
||||||
pub async fn perform(self) -> Result<()> {
|
pub async fn perform(self) -> Result<()> {
|
||||||
let result = try_join!(
|
let result = try_join!(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue