aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorTill Höppner2016-03-02 12:57:36 +0100
committerTill Höppner2016-03-02 12:57:36 +0100
commita4db0628a0377b39be02f0e83832b0c3527933e1 (patch)
tree375e33b2942b6374e352b554d7202664812ddf2f /base
parent52d4c29f5bce85abadeb9fd394f55caf488b37f3 (diff)
downloadilc-a4db0628a0377b39be02f0e83832b0c3527933e1.tar.gz
ilc-a4db0628a0377b39be02f0e83832b0c3527933e1.tar.xz
ilc-a4db0628a0377b39be02f0e83832b0c3527933e1.zip
Merging of any number of logsv0.3.0v0.3
Diffstat (limited to 'base')
-rw-r--r--base/Cargo.toml2
-rw-r--r--base/src/context.rs10
-rw-r--r--base/src/dummy.rs3
-rw-r--r--base/src/lib.rs6
4 files changed, 16 insertions, 5 deletions
diff --git a/base/Cargo.toml b/base/Cargo.toml
index 541de02..f82cff0 100644
--- a/base/Cargo.toml
+++ b/base/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ilc-base"
-version = "0.1.2"
+version = "0.2.0"
description = "IRC log converter/collector/cruncher"
homepage = "https://github.com/tilpner/ilc"
license = "Apache-2.0"
diff --git a/base/src/context.rs b/base/src/context.rs
index 4393457..fe264ab 100644
--- a/base/src/context.rs
+++ b/base/src/context.rs
@@ -7,3 +7,13 @@ pub struct Context {
pub override_date: Option<NaiveDate>,
pub channel: Option<String>,
}
+
+impl Default for Context {
+ fn default() -> Context {
+ Context {
+ timezone: FixedOffset::west(0),
+ override_date: None,
+ channel: None,
+ }
+ }
+}
diff --git a/base/src/dummy.rs b/base/src/dummy.rs
index 9317c4e..a0ab8b4 100644
--- a/base/src/dummy.rs
+++ b/base/src/dummy.rs
@@ -18,10 +18,11 @@ use std::io::BufRead;
use event::Event;
use context::Context;
+#[derive(Copy, Clone)]
pub struct Dummy;
impl ::Decode for Dummy {
- fn decode<'a>(&'a mut self,
+ fn decode<'a>(&'a self,
_context: &'a Context,
_input: &'a mut BufRead)
-> Box<Iterator<Item = ::Result<Event<'a>>> + 'a> {
diff --git a/base/src/lib.rs b/base/src/lib.rs
index 1f56dcd..f2777e3 100644
--- a/base/src/lib.rs
+++ b/base/src/lib.rs
@@ -26,7 +26,7 @@ pub mod dummy;
use std::io::{BufRead, Write};
pub use context::Context;
-pub use event::Event;
+pub use event::{Event, Time};
pub use error::*;
pub trait Encode {
@@ -37,8 +37,8 @@ pub trait Encode {
-> error::Result<()>;
}
-pub trait Decode {
- fn decode<'a>(&'a mut self,
+pub trait Decode {
+ fn decode<'a>(&'a self,
context: &'a Context,
input: &'a mut BufRead)
-> Box<Iterator<Item = error::Result<Event<'a>>> + 'a>;