Skip to main content

Task

Struct Task 

Source
pub struct Task {
Show 15 fields pub id: u32, pub kind: Kind, pub title: String, pub tags: Vec<String>, pub links: Vec<u32>, pub repo_links: Vec<RepoLink>, pub status: Status, pub decision: DecisionState, pub created: DateTime<Local>, pub description: String, pub comments: Vec<Comment>, pub history: Vec<StatusChange>, pub sessions: Vec<Session>, pub path: Option<PathBuf>, pub unknown: Unknown,
}
Expand description

An entry: a task, note or decision. What it is, how it’s tagged and linked, and for tasks, where it stands and how it got there.

Fields§

§id: u32

Unique number across all kinds, also the start of the file name.

§kind: Kind

Task, note or decision.

§title: String

One-line title.

§tags: Vec<String>

Lowercase, without the leading #.

§links: Vec<u32>

Ids of related entries, in the order they were added. Deleting an entry removes the links to it.

§repo_links: Vec<RepoLink>

Related entries in the project’s other repositories, in the order they were added. Nothing checks them once written: the other repository may be elsewhere, or the entry deleted there since.

§status: Status

Where the task stands.

§decision: DecisionState

Decisions only: whether it’s in force, proposed or rejected.

§created: DateTime<Local>

When the task was created.

§description: String

Free text describing the task.

§comments: Vec<Comment>

Oldest first.

§history: Vec<StatusChange>

Every status change, oldest first.

§sessions: Vec<Session>

Tracked work, oldest first; only the last one can be open, and only while the task is doing.

§path: Option<PathBuf>

File this task was loaded from / saved to.

§unknown: Unknown

What the file holds that this version doesn’t understand, written back as it was.

Implementations§

Source§

impl Task

Source

pub fn to_markdown(&self) -> String

The task as a markdown file (see the format at the top of this module).

Source

pub fn from_markdown(text: &str) -> Result<Task, String>

Parses a task file. Unknown - key: lines, link words and ## sections are kept as written; open sessions that can’t be running are closed (see Parsed::into_task).

Source§

impl Task

Source

pub fn new(id: u32, title: String, now: DateTime<Local>) -> Self

A new todo task.

Source

pub fn set_status( &mut self, status: Status, now: DateTime<Local>, by: Author, ) -> bool

Moves the task to status and records the change, made by someone. Returns false if it already was there. Leaving doing closes the open session, so a clock never keeps running on a task that isn’t being worked on.

Source

pub fn is_running(&self) -> bool

Whether the last session is still open.

Source

pub fn running_for(&self, now: DateTime<Local>) -> Option<Duration>

How long the open session has been running, if any.

Source

pub fn start_session(&mut self, now: DateTime<Local>)

Opens a session now, unless one is already running. The caller moves the task to doing.

Source

pub fn stop_session(&mut self, now: DateTime<Local>)

Closes the open session, if any.

Source

pub fn total(&self, now: DateTime<Local>) -> Duration

Time tracked in all sessions.

Source

pub fn time_between( &self, from: DateTime<Local>, to: DateTime<Local>, now: DateTime<Local>, ) -> Duration

Time tracked inside [from, to): sessions are clipped to the range.

Source

pub fn status_since(&self) -> DateTime<Local>

When the status last changed (or the task was created, if never); used for sorting.

Source

pub fn asked(&self) -> Option<Asked<'_>>

The question this parked task waits on, or its answer. A question is the latest comment marked as one; a person’s comment after it answers it. Starting the task after either means it was picked up, so it’s neither once the task is parked again for another reason.

Source

pub fn is_task(&self) -> bool

Whether this entry has a status, history and sessions (only tasks do).

Source

pub fn matches(&self, query: &str) -> bool

Search: every whitespace-separated term must match. #term matches a tag prefix; anything else matches the title or a tag. Case-insensitive.

Trait Implementations§

Source§

impl Clone for Task

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Task

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Task

§

impl RefUnwindSafe for Task

§

impl Send for Task

§

impl Sync for Task

§

impl Unpin for Task

§

impl UnsafeUnpin for Task

§

impl UnwindSafe for Task

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.