1
use crate::commands::{
2
    Command, Request, RequestParserError, RequestParserResult, ResponseAttributes,
3
    ResponseParserError,
4
};
5

            
6
pub struct Unsubscribe;
7

            
8
impl Command for Unsubscribe {
9
    type Response = ();
10
    const COMMAND: &'static str = "unsubscribe";
11

            
12
    fn parse_request(mut parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> {
13
        let channel_name = parts.next().ok_or(RequestParserError::UnexpectedEOF)?;
14

            
15
        debug_assert!(parts.next().is_none());
16

            
17
        Ok((Request::Unsubscribe(channel_name.to_string()), ""))
18
    }
19

            
20
    fn parse_response(
21
        parts: ResponseAttributes<'_>,
22
    ) -> Result<Self::Response, ResponseParserError> {
23
        debug_assert!(parts.is_empty());
24
        Ok(())
25
    }
26
}