isbnlib/jsonb/
authors_list_element.rs

1use crate::enums::author_list_element_type::AuthorListElementType;
2use crate::enums::string_or_key_value_block::StringOrKeyValueBlock;
3use serde::{Deserialize, Serialize};
4
5#[derive(
6Serialize,
7Deserialize,
8Debug,
9Clone,
10PartialEq,
11)]
12pub struct AuthorsListElement {
13    #[serde(rename(deserialize = "type"))]
14    pub value_type:  AuthorListElementType,
15    pub author: Option<StringOrKeyValueBlock>
16}
17
18impl AuthorsListElement {
19    pub fn to_string(self) -> String {
20        match self.author {
21            Some(author) => author.to_string(),
22            None => String::new()
23        }
24    }
25}