Lines
0 %
Functions
use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use crate::{
commands::{CommandResponse, ResponseParserError, single_optional_item_command_request},
response_tokenizer::{ResponseAttributes, get_and_parse_property},
types::Uri,
};
single_optional_item_command_request!(Update, "update", Uri);
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct UpdateResponse {
updating_db: usize,
}
impl UpdateResponse {
pub fn new(updating_db: usize) -> Self {
UpdateResponse { updating_db }
impl CommandResponse for UpdateResponse {
type Request = UpdateRequest;
fn parse(parts: ResponseAttributes<'_>) -> Result<Self, ResponseParserError> {
let parts: HashMap<_, _> = parts.into_map()?;
let updating_db = get_and_parse_property!(parts, "updating_db", Text);
Ok(UpdateResponse { updating_db })
fn serialize(&self) -> Vec<u8> {
unimplemented!("response serialization is not yet implemented for UpdateResponse")