empidee/src/commands/connection_settings/protocol_disable.rs
2024-12-02 21:00:22 +01:00

35 lines
906 B
Rust

use crate::{
commands::{
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
},
Request,
};
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);
}
let mut protocols = Vec::new();
for protocol in parts {
protocols.push(protocol.to_string());
}
Ok((Request::ProtocolDisable(protocols), ""))
}
fn parse_response(
parts: ResponseAttributes<'_>,
) -> Result<Self::Response, ResponseParserError> {
debug_assert!(parts.is_empty());
Ok(())
}
}