From 0325d6f68e5405e9308e54687f45de1d0ff48f58 Mon Sep 17 00:00:00 2001 From: trivernis Date: Tue, 1 Sep 2020 15:18:09 +0200 Subject: [PATCH] Add thesis source Signed-off-by: trivernis --- src/bibliography/bib_types/mod.rs | 4 +++- src/bibliography/bib_types/thesis.rs | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/bibliography/bib_types/thesis.rs diff --git a/src/bibliography/bib_types/mod.rs b/src/bibliography/bib_types/mod.rs index 00013c3..b8042b1 100644 --- a/src/bibliography/bib_types/mod.rs +++ b/src/bibliography/bib_types/mod.rs @@ -4,6 +4,7 @@ use crate::bibliography::bib_types::booklet::Booklet; use crate::bibliography::bib_types::in_book::InBook; use crate::bibliography::bib_types::in_collection::InCollection; use crate::bibliography::bib_types::manual::Manual; +use crate::bibliography::bib_types::thesis::Thesis; use chrono::{Date, Local}; pub mod article; @@ -12,6 +13,7 @@ pub mod booklet; pub mod in_book; pub mod in_collection; pub mod manual; +pub mod thesis; pub type LocalDate = Date; @@ -24,7 +26,7 @@ pub enum BibliographyType { InBook(InBook), InCollection(InCollection), Manual(Manual), - Thesis, + Thesis(Thesis), TechReport, Unpublished, Misc, diff --git a/src/bibliography/bib_types/thesis.rs b/src/bibliography/bib_types/thesis.rs new file mode 100644 index 0000000..a963bf5 --- /dev/null +++ b/src/bibliography/bib_types/thesis.rs @@ -0,0 +1,24 @@ +use crate::bibliography::bib_types::LocalDate; + +/// A thesis source entry +#[derive(Clone, Debug)] +pub struct Thesis { + author: String, + title: String, + school: String, + date: LocalDate, + address: Option, +} + +impl Thesis { + /// Creates a new thesis with only the mandatory fields filled + pub fn new(author: String, title: String, school: String, date: LocalDate) -> Self { + Self { + author, + title, + school, + date, + address: None, + } + } +}