feat(title): add method to get planning timestamps
This commit is contained in:
parent
6fbe5a8085
commit
3a1b568743
|
@ -16,7 +16,7 @@ use nom::{
|
|||
};
|
||||
|
||||
use crate::config::ParseConfig;
|
||||
use crate::elements::{Drawer, Planning};
|
||||
use crate::elements::{Drawer, Planning, Timestamp};
|
||||
use crate::parsers::{line, skip_empty_lines, take_one_word};
|
||||
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
|
@ -106,6 +106,24 @@ impl Title<'_> {
|
|||
))
|
||||
}
|
||||
|
||||
pub fn closed(&self) -> Option<&Timestamp> {
|
||||
self.planning
|
||||
.as_ref()
|
||||
.and_then(|planning| planning.closed.as_ref())
|
||||
}
|
||||
|
||||
pub fn scheduled(&self) -> Option<&Timestamp> {
|
||||
self.planning
|
||||
.as_ref()
|
||||
.and_then(|planning| planning.scheduled.as_ref())
|
||||
}
|
||||
|
||||
pub fn deadline(&self) -> Option<&Timestamp> {
|
||||
self.planning
|
||||
.as_ref()
|
||||
.and_then(|planning| planning.deadline.as_ref())
|
||||
}
|
||||
|
||||
pub fn into_owned(self) -> Title<'static> {
|
||||
Title {
|
||||
level: self.level,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::fmt;
|
||||
use std::io::{Error, Write};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use jetscii::{bytes, BytesConst};
|
||||
|
||||
|
|
Loading…
Reference in a new issue