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