[][src]Struct pomodoro::PomodoroSession

pub struct PomodoroSession<R, W> { /* fields omitted */ }

This struct represents a pomodoro session - which is from the start of running the application until you terminate it. Between that time this struct will keep track of the initial height and width of the terminal window when launching pomodoro, and keep a lock on stdin and stdout so we can draw to the screen, and also accept async input from the user. Lastly, this session also holds a state tracker, the clock itself (that gets drawn) and a config file. The config is passed in by the user. -w flag will pass in a custom work time, -s will pass in a custom short break time, and -l will pass in a custom long break time.

Methods

impl<R: Read, W: Write> PomodoroSession<R, W>[src]

pub fn start_work(&mut self)[src]

Call a start to a work cycle.

pub fn reset_current_pomodoro(&mut self)[src]

Reset the current pomodoro by decrementing the cycle and re-running start_work.

pub fn countdown(&mut self)[src]

Checks the pomodoro state (Working, ShortBreak, or LongBreak) and runs the appropraite internal countdown method.

pub fn countdown_work(&mut self)[src]

Countdown count for work - with syncing so we are never more than a ms off from true time.

pub fn start_break(&mut self)[src]

Starts a break by matching which break state we are in (short or long) and then running the appropriate break function.

pub fn short_break(&mut self)[src]

Sets the break time by referencing the config (flags passed in on start) and then starts the countdown clock.

pub fn long_break(&mut self)[src]

Sets the break time by referencing the config (flags passed in on start) and then starts the countdown clock.

pub fn countdown_break(&mut self, duration: u64)[src]

Countdown clock for a break - extremely similar to countdown-work - separate because the notifications after the loops are different. Good place for a refactor.

pub fn draw_work_screen(&mut self)[src]

CLOCK AND DRAWING METHODS Draws the work clock on the screen.

pub fn draw_break_screen(&mut self)[src]

Draws the break clock on the screen.

pub fn draw_centered(&mut self, item: &str, height_offset: Option<u16>) -> usize[src]

Takes in an input string and prints it centered on the screen Returns the last line it was printed on in case another method needs to know that to clear space after it.

pub fn draw_clock(&mut self, clock: String)[src]

Draws the clock on the screen.

pub fn draw_work_count(&mut self)[src]

Draws the current work count on the screen.

Example:

"Work Period 1 or 4"

pub fn draw_controls_help(&mut self)[src]

Draws the section of the screen when the work and break clocks are rolling that actively remind user of async commands they can issue at any time to restart or quit the current cycle.

pub fn display_menu(&mut self, menu: Option<&'static str>)[src]

Displays the pomodoro menu that is seen either at the start (large menu) or between pomodoros (small menu)

pub fn wait_for_next_command(&mut self) -> Command[src]

WAITS (in a loop) for the next user command (happens between pomodoros).

pub fn async_command_listen(&mut self) -> Command[src]

listens for the next command while clock is counting down in a non-blocking (async) fashion.

Auto Trait Implementations

impl<R, W> Send for PomodoroSession<R, W> where
    R: Send,
    W: Send

impl<R, W> Sync for PomodoroSession<R, W> where
    R: Sync,
    W: Sync

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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