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

            
9
pub struct MixRampDelay;
10

            
11
impl Command for MixRampDelay {
12
    type Response = ();
13
    const COMMAND: &'static str = "mixrampdelay";
14

            
15
    fn parse_request(mut parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> {
16
        let seconds = match parts.next() {
17
            Some(s) => s
18
                .parse::<Seconds>()
19
                .map_err(|_| RequestParserError::SyntaxError(0, s.to_owned()))?,
20
            None => return Err(RequestParserError::UnexpectedEOF),
21
        };
22

            
23
        debug_assert!(parts.next().is_none());
24

            
25
        Ok((Request::MixRampDelay(seconds), ""))
26
    }
27

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