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

            
6
pub struct MixRampDb;
7

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

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

            
20
        debug_assert!(parts.next().is_none());
21

            
22
        Ok((Request::MixRampDb(db), ""))
23
    }
24

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