1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
use super::StreamCommand;
use crate::errors::SonicError;

#[derive(Debug, Default)]
pub struct PingCommand;

impl StreamCommand for PingCommand {
    type Response = bool;

    fn message(&self) -> String {
        String::from("PING\r\n")
    }

    fn receive(&self, message: String) -> Result<<Self as StreamCommand>::Response, SonicError> {
        dbg!(&message);
        Ok(message == "PONG\r\n")
    }
}