31 lines
813 B
Rust
31 lines
813 B
Rust
use crate::{
|
|
Request,
|
|
commands::{
|
|
Command, RequestParserError, RequestParserResult, ResponseAttributes, ResponseParserError,
|
|
},
|
|
};
|
|
|
|
pub struct PlaylistId;
|
|
|
|
impl Command for PlaylistId {
|
|
type Response = ();
|
|
const COMMAND: &'static str = "playlistid";
|
|
|
|
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::PlaylistId(id), ""))
|
|
}
|
|
|
|
fn parse_response(
|
|
_parts: ResponseAttributes<'_>,
|
|
) -> Result<Self::Response, ResponseParserError> {
|
|
unimplemented!()
|
|
}
|
|
}
|