[][src]Struct rtw::OngoingActivity

pub struct OngoingActivity {
    pub start_time: DateTimeW,
    pub tags: Tags,
}

A started and unfinished activity (no stop time)

Fields

start_time: DateTimeW

start time

tags: Tags

Activity tags

Methods

impl OngoingActivity[src]

pub fn new(start_time: DateTimeW, tags: Tags) -> Self[src]

Constructor

pub fn get_start_time(&self) -> DateTimeW[src]

Start time getter

pub fn get_title(&self) -> String[src]

Return title (activity tags joined by a space)

let activity = OngoingActivity::new(chrono::Local::now().into(), vec![String::from("foo"), String::from("bar")]);
assert_eq!(activity.get_title(), "foo bar");

pub fn into_activity(self, stop_time: DateTimeW) -> Result<Activity>[src]

Convert active activity to finished activity

let activity = OngoingActivity::new(chrono::Local::now().into(), vec![String::from("foo"), String::from("bar")]);
let finished: Activity = activity.into_activity(chrono::Local::now().into()).unwrap();

stop_time should be >= start_time otherwise error

Trait Implementations

impl Clone for OngoingActivity[src]

impl Debug for OngoingActivity[src]

impl<'de> Deserialize<'de> for OngoingActivity[src]

impl Serialize for OngoingActivity[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.