use crate::{ Request, commands::{ Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError, }, }; pub struct RangeId; impl Command for RangeId { type Response = (); const COMMAND: &'static str = "rangeid"; fn parse_request(mut parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> { let songid = parts.next().ok_or(RequestParserError::UnexpectedEOF)?; let songid = songid .parse() .map_err(|_| RequestParserError::SyntaxError(0, songid.to_string()))?; let timeinterval = parts.next().ok_or(RequestParserError::UnexpectedEOF)?; let timeinterval = timeinterval .parse() .map_err(|_| RequestParserError::SyntaxError(0, timeinterval.to_string()))?; debug_assert!(parts.next().is_none()); Ok((Request::RangeId(songid, timeinterval), "")) } fn parse_response( parts: ResponseAttributes<'_>, ) -> Result { debug_assert!(parts.is_empty()); Ok(()) } }