From a181f142fc9d997d5046011d148005f3e7b51d30 Mon Sep 17 00:00:00 2001 From: trivernis Date: Tue, 1 Sep 2020 20:46:29 +0200 Subject: [PATCH] Add Unpublished source type Signed-off-by: trivernis --- src/bibliography/bib_types/mod.rs | 4 +++- src/bibliography/bib_types/unpublished.rs | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/bibliography/bib_types/unpublished.rs diff --git a/src/bibliography/bib_types/mod.rs b/src/bibliography/bib_types/mod.rs index 2fbe364..9cb6108 100644 --- a/src/bibliography/bib_types/mod.rs +++ b/src/bibliography/bib_types/mod.rs @@ -6,6 +6,7 @@ use crate::bibliography::bib_types::in_collection::InCollection; use crate::bibliography::bib_types::manual::Manual; use crate::bibliography::bib_types::tech_report::TechReport; use crate::bibliography::bib_types::thesis::Thesis; +use crate::bibliography::bib_types::unpublished::Unpublished; use chrono::{Date, Local}; pub mod article; @@ -16,6 +17,7 @@ pub mod in_collection; pub mod manual; pub mod tech_report; pub mod thesis; +pub mod unpublished; pub type LocalDate = Date; @@ -30,7 +32,7 @@ pub enum BibliographyType { Manual(Manual), Thesis(Thesis), TechReport(TechReport), - Unpublished, + Unpublished(Unpublished), Misc, Url, Repository, diff --git a/src/bibliography/bib_types/unpublished.rs b/src/bibliography/bib_types/unpublished.rs new file mode 100644 index 0000000..0c1c057 --- /dev/null +++ b/src/bibliography/bib_types/unpublished.rs @@ -0,0 +1,20 @@ +use crate::bibliography::bib_types::LocalDate; + +/// A source that is not formally published +#[derive(Clone, Debug)] +pub struct Unpublished { + pub author: String, + pub title: String, + pub date: Option, +} + +impl Unpublished { + /// Creates a new source of type unpublished with only the mandatory fields filled + pub fn new(author: String, title: String) -> Self { + Self { + author, + title, + date: None, + } + } +}