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