Module entry

Source
Expand description

Module representing an entry in the timelog.

§Examples

use timelog::entry::Entry;
use std::fs::File;
use std::io::{BufRead, BufReader};

fn day_entrys(date: &str, file: &mut File) -> Vec<Entry> {
    let mut reader = BufReader::new(file);
    reader.lines()
          .filter_map(|line| Entry::from_line(&line.ok()?).ok())
          .filter(|ev| ev.stamp() == String::from(date))
          .collect::<Vec<Entry>>()
}

§Description

Objects of this type represent the individual lines in the timelog.txt file. Each Entry has a date and time stamp, an optional project, and a task.

Re-exports§

pub use error::EntryError;
pub use kind::EntryKind;

Modules§

error
Module representing errors encountered parsing entry lines.
kind
Module representing the kind of an entry.

Structs§

Entry
Representation of an entry in the log

Statics§

MARKER_RE
Regular expression extracting the marker from the line.
PROJECT_RE
A regular expression matching the project part of an entry line.
YEAR_RE
Regular expression matching the year portion of an entry line.