Struct aquote::quote_manager::QuoteManager[][src]

pub struct QuoteManager { /* fields omitted */ }

Implementations

impl QuoteManager[src]

pub fn new(
    quotes: impl Into<VecDeque<Quote>>,
    path: impl Into<PathBuf>,
    max_quotes: usize
) -> Result<Self>
[src]

Create new QuoteManager instance.

This constructor does not load quotes from the specified file path, but uses the provided quotes deque. To load from a quotes file, use QuoteManager::load instead.

Errors

An error is returned if max_quotes is less than 1.

pub fn load(path: impl Into<PathBuf>, max_quotes: usize) -> Result<Self>[src]

Load quotes from file.

If the quotes file does not exist, initialize the QuoteManager with an empty quote deque.

Errors

An error is returned if max_quotes is less than 1.

pub fn save(&self) -> Result<()>[src]

Save quotes to file.

pub fn push(&mut self, quote: Quote)[src]

Push quote, truncating the quote deque if it exceeds the maximum number of quotes.

pub fn list(&self) -> &VecDeque<Quote>[src]

List quotes, ordered from most recent to least recent.

pub fn get(&self) -> Option<&Quote>[src]

Get latest quote.

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> From<T> for T[src]

impl<T> Instrument for T[src]

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

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.

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