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

            
6
pub struct BinaryLimit;
7

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

            
12
    fn parse_request(mut parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> {
13
        let limit = parts.next().ok_or(RequestParserError::UnexpectedEOF)?;
14
        let limit = limit
15
            .parse()
16
            .map_err(|_| RequestParserError::SyntaxError(0, limit.to_string()))?;
17
        debug_assert!(parts.next().is_none());
18
        Ok((Request::BinaryLimit(limit), ""))
19
    }
20

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