pub struct GraphModelSteps { /* private fields */ }
Expand description

A GraphModelSteps manages step data for easy consumption in views.

Implementations§

source§

impl GraphModelSteps

source

pub fn new() -> Self

source

pub fn today_step_count(&self) -> Option<u32>

Get how many steps have been done today.

Returns

The amount of steps that have been done today, none None if no steps have been done yet.

source

pub fn streak_count_today(&self, step_goal: u32) -> u32

Get how many days the user has upheld their step streak (as in have reached their step goal), including today.

Returns

The number of days.

source

pub fn streak_count_yesterday(&self, step_goal: u32) -> u32

Get how many days the user has upheld their step streak (as in have reached their step goal), excluding today.

Returns

The number of days.

source

pub async fn reload(&mut self, duration: TimeSpan) -> Result<()>

Reload the data from the Tracker Database.

Arguments
  • duration - How far in the past the data should reach back.
Returns

Returns an error if querying the DB fails.

source

pub fn to_points(&self) -> Vec<Point>

Converts the model’s data to an array of Point so it can be displayed in a GraphView.

source

pub fn is_empty(&self) -> bool

Get if the model is empty.

Trait Implementations§

source§

impl Debug for GraphModelSteps

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for GraphModelSteps

source§

fn default() -> GraphModelSteps

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V