Implement some more commands
This commit is contained in:
31
src/commands/queue/deleteid.rs
Normal file
31
src/commands/queue/deleteid.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
use crate::{
|
||||
commands::{
|
||||
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
|
||||
},
|
||||
Request,
|
||||
};
|
||||
|
||||
pub struct DeleteId;
|
||||
|
||||
impl Command for DeleteId {
|
||||
type Response = ();
|
||||
const COMMAND: &'static str = "deleteid";
|
||||
|
||||
fn parse_request(mut parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> {
|
||||
let id = parts.next().ok_or(RequestParserError::UnexpectedEOF)?;
|
||||
let id = id
|
||||
.parse()
|
||||
.map_err(|_| RequestParserError::SyntaxError(0, id.to_string()))?;
|
||||
|
||||
debug_assert!(parts.next().is_none());
|
||||
|
||||
Ok((Request::DeleteId(id), ""))
|
||||
}
|
||||
|
||||
fn parse_response(
|
||||
parts: ResponseAttributes<'_>,
|
||||
) -> Result<Self::Response, ResponseParserError> {
|
||||
debug_assert!(parts.is_empty());
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user