isbnlib/enums/string_or_key_value_block.rs
use serde::{Deserialize, Serialize};
use crate::jsonb::key_value_block::KeyValueBlock;
#[derive(
Serialize,
Deserialize,
Debug,
Clone,
PartialEq,
)]
#[serde(untagged)]
pub enum StringOrKeyValueBlock {
String(String),
KeyValueBlock(KeyValueBlock)
}
impl StringOrKeyValueBlock {
pub fn to_string(self) -> String {
match self {
StringOrKeyValueBlock::String(string) => string,
StringOrKeyValueBlock::KeyValueBlock(block) => block.key
}
}
}