Lines
0 %
Functions
use std::collections::HashMap;
use crate::commands::{
get_and_parse_property, Command, Request, RequestParserResult, ResponseAttributes,
ResponseParserError,
};
pub struct Rescan;
pub struct RescanResponse {
pub updating_db: usize,
}
impl Command for Rescan {
type Response = RescanResponse;
const COMMAND: &'static str = "rescan";
fn parse_request(mut parts: std::str::SplitWhitespace<'_>) -> RequestParserResult<'_> {
let uri = parts.next().map(|s| s.to_string());
debug_assert!(parts.next().is_none());
Ok((Request::Rescan(uri), ""))
fn parse_response(
parts: ResponseAttributes<'_>,
) -> Result<Self::Response, ResponseParserError> {
let parts: HashMap<_, _> = parts.into();
let updating_db = get_and_parse_property!(parts, "updating_db", Text);
Ok(RescanResponse { updating_db })