A rust library for de(serializing) files and text in the todo.txt format.
This crate is still early in development, the api is not stable and will change in the future.
Having said that, the core of the crate (parsing) is implemented and should function correctly.
Add it to the dependencies of your Cargo.toml
:
toml
[dependencies]
tdtxt = "0.1"
Then use it:
```rust use std::str::FromStr as _;
use tdtxt::todo::{Todo, Date, State, Priority, DateCompound};
let line = "x (A) 2016-05-20 2016-04-30 measure space for +chapelShelving @chapel due:2016-05-30"; let todo = Todo::from_str(line).unwrap();
asserteq!(todo.state(), Some(&State::Done)); asserteq!(todo.priority(), Some(&Priority::A)); asserteq!(todo.datecompound(), Some(&DateCompound::Completed { created: Date::ymd(2016, 4, 30), completed: Date::ymd(2016, 5, 20) })); asserteq!(todo.description().description(), "measure space for +chapelShelving @chapel due:2016-05-30"); asserteq!(todo.description().projects(), vec!["chapelShelving"]); asserteq!(todo.description().contexts(), vec!["chapel"]); asserteq!(todo.description().custom(), vec![("due", "2016-05-30")]); ```