Skip to main content

Stats

Struct Stats 

Source
pub struct Stats { /* private fields */ }

Implementations§

Source§

impl Stats

Source

pub fn open(path: &Path) -> Result<Self>

Opens the statistics database, creating it if it does not exist.

Source

pub fn in_memory() -> Result<Self>

Source

pub fn record_use(&self, id: &str, now: i64) -> Result<()>

Records that an entry was selected, decaying its previous score first.

Source

pub fn record_new(&self, id: &str, now: i64) -> Result<()>

Gives a newly saved entry its head start.

Source

pub fn scores(&self, now: i64) -> Result<HashMap<String, Score>>

Current scores for every entry that has one, decayed to now.

Entries absent from the result have never been used and rank below any entry that has.

Source

pub fn set_pinned(&self, id: &str, pinned: bool, now: i64) -> Result<()>

Source

pub fn remember_param(&self, id: &str, name: &str, value: &str) -> Result<()>

Remembers the value last entered for a placeholder, so the next prompt arrives pre-filled.

Source

pub fn last_params(&self, id: &str) -> Result<BTreeMap<String, String>>

Source

pub fn forget(&self, id: &str) -> Result<()>

Drops everything remembered about an entry the user deleted.

Auto Trait Implementations§

§

impl !Freeze for Stats

§

impl !RefUnwindSafe for Stats

§

impl !Sync for Stats

§

impl !UnwindSafe for Stats

§

impl Send for Stats

§

impl Unpin for Stats

§

impl UnsafeUnpin for Stats

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