|
|
|
@ -1,4 +1,8 @@
|
|
|
|
|
use crate::utils::date::LocalDate;
|
|
|
|
|
use crate::bibliography::keys::{K_ADDRESS, K_AUTHOR, K_DATE, K_INSTITUTION, K_NUMBER, K_TITLE};
|
|
|
|
|
use crate::bibliography::FromHashMap;
|
|
|
|
|
use crate::utils::date::{parse_date, LocalDate};
|
|
|
|
|
use std::collections::hash_map::RandomState;
|
|
|
|
|
use std::collections::HashMap;
|
|
|
|
|
|
|
|
|
|
/// A tech report for example a white paper
|
|
|
|
|
#[derive(Clone, Debug)]
|
|
|
|
@ -24,3 +28,19 @@ impl TechReport {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl FromHashMap for TechReport {
|
|
|
|
|
fn from_hash_map(map: &HashMap<String, String, RandomState>) -> Option<Box<Self>> {
|
|
|
|
|
let author = map.get(K_AUTHOR)?;
|
|
|
|
|
let title = map.get(K_TITLE)?;
|
|
|
|
|
let institution = map.get(K_INSTITUTION)?;
|
|
|
|
|
let date = map.get(K_DATE).and_then(|d| parse_date(d))?;
|
|
|
|
|
let mut tech_report =
|
|
|
|
|
TechReport::new(author.clone(), title.clone(), institution.clone(), date);
|
|
|
|
|
|
|
|
|
|
tech_report.number = map.get(K_NUMBER).cloned();
|
|
|
|
|
tech_report.address = map.get(K_ADDRESS).cloned();
|
|
|
|
|
|
|
|
|
|
Some(Box::new(tech_report))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|