36 lines
967 B
Rust
36 lines
967 B
Rust
use crate::{
|
|
Request,
|
|
commands::{
|
|
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
|
|
},
|
|
};
|
|
|
|
pub struct ProtocolDisable;
|
|
|
|
impl Command for ProtocolDisable {
|
|
type Response = ();
|
|
const COMMAND: &'static str = "protocol disable";
|
|
|
|
fn parse_request(parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> {
|
|
let mut parts = parts.peekable();
|
|
if parts.peek().is_none() {
|
|
return Err(RequestParserError::UnexpectedEOF);
|
|
}
|
|
|
|
// TODO: verify that the features are split by whitespace
|
|
let mut features = Vec::new();
|
|
for feature in parts {
|
|
features.push(feature.to_string());
|
|
}
|
|
|
|
Ok((Request::ProtocolDisable(features), ""))
|
|
}
|
|
|
|
fn parse_response(
|
|
parts: ResponseAttributes<'_>,
|
|
) -> Result<Self::Response, ResponseParserError> {
|
|
debug_assert!(parts.is_empty());
|
|
Ok(())
|
|
}
|
|
}
|