From e8e4ec112bf872bafe2c172163b6466197a9223c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 20 May 2017 15:15:56 +0200 Subject: [PATCH] Remove builder pattern, we really dont need it here --- libimagentrydate/Cargo.toml | 1 - libimagentrydate/src/datepath/compiler.rs | 27 ++++++----------------- libimagentrydate/src/lib.rs | 1 - 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/libimagentrydate/Cargo.toml b/libimagentrydate/Cargo.toml index 4c694f52..6ea5d084 100644 --- a/libimagentrydate/Cargo.toml +++ b/libimagentrydate/Cargo.toml @@ -18,7 +18,6 @@ chrono = "0.3" toml-query = "0.1" lazy_static = "0.2" toml = "0.4" -derive_builder = "0.4" [dependencies.libimagerror] path = "../libimagerror" diff --git a/libimagentrydate/src/datepath/compiler.rs b/libimagentrydate/src/datepath/compiler.rs index 4f512bfc..9652ac38 100644 --- a/libimagentrydate/src/datepath/compiler.rs +++ b/libimagentrydate/src/datepath/compiler.rs @@ -25,26 +25,6 @@ use datepath::accuracy::Accuracy; use datepath::format::Format; use datepath::result::Result; -/// A builder for the DatePath object which can then be used to compile a time definition into a -/// StoreId. -#[derive(Builder, Debug)] -#[builder(setter(prefix = "with"))] -pub struct DatePathCompilerBuilder { - - /// The accuracy which should be used to compile the time definition. - /// - /// For example a `Accuracy::Hour` will ignore the minute and second from the time definition, - /// a `Accuracy::Month` will ignore days, hours, minutes and seconds. - #[builder(default)] - accuracy : Accuracy, - - /// The formatter which shall be used to compile the time specification. - #[builder(default)] - format : Format, - -} - - pub struct DatePathCompiler { accuracy : Accuracy, format : Format, @@ -52,6 +32,13 @@ pub struct DatePathCompiler { impl DatePathCompiler { + pub fn new(accuracy: Accuracy, format: Format) -> DatePathCompiler { + DatePathCompiler { + accuracy : accuracy, + format : format, + } + } + /// Compile a NaiveDateTime object into a StoreId object. /// /// # More information diff --git a/libimagentrydate/src/lib.rs b/libimagentrydate/src/lib.rs index 16829046..df78c20f 100644 --- a/libimagentrydate/src/lib.rs +++ b/libimagentrydate/src/lib.rs @@ -18,7 +18,6 @@ // #[macro_use] extern crate lazy_static; -#[macro_use] extern crate derive_builder; extern crate chrono; extern crate toml_query; extern crate toml;