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

            
8
pub struct ProtocolDisable;
9

            
10
impl Command for ProtocolDisable {
11
    type Response = ();
12
    const COMMAND: &'static str = "protocol disable";
13

            
14
    fn parse_request(parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> {
15
        let mut parts = parts.peekable();
16
        if parts.peek().is_none() {
17
            return Err(RequestParserError::UnexpectedEOF);
18
        }
19

            
20
        // TODO: verify that the features are split by whitespace
21
        let mut features = Vec::new();
22
        for feature in parts {
23
            features.push(feature.to_string());
24
        }
25

            
26
        Ok((Request::ProtocolDisable(features), ""))
27
    }
28

            
29
    fn parse_response(
30
        parts: ResponseAttributes<'_>,
31
    ) -> Result<Self::Response, ResponseParserError> {
32
        debug_assert!(parts.is_empty());
33
        Ok(())
34
    }
35
}