Struct aquote::quote_manager::QuoteManager [−][src]
Implementations
impl QuoteManager
[src]
pub fn new(
quotes: impl Into<VecDeque<Quote>>,
path: impl Into<PathBuf>,
max_quotes: usize
) -> Result<Self>
[src]
quotes: impl Into<VecDeque<Quote>>,
path: impl Into<PathBuf>,
max_quotes: usize
) -> Result<Self>
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
impl RefUnwindSafe for QuoteManager
impl Send for QuoteManager
impl Sync for QuoteManager
impl Unpin for QuoteManager
impl UnwindSafe for QuoteManager
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,