pubmed 0.2.1

A wrapper around the PubMed API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PublicationType {
    pub ui: Option<String>,
    pub name: Option<String>,
}

impl PublicationType {
    #[must_use] 
    pub fn new_from_xml(node: &roxmltree::Node) -> Self {
        Self {
            ui: node.attribute("UI").map(std::string::ToString::to_string),
            name: node.text().map(std::string::ToString::to_string),
        }
    }
}