Struct FileHistory

pub struct FileHistory { /* private fields */ }

Current state of the history stored in a file.

Implementations

impl FileHistory

fn new() -> Self

Default constructor

fn with_config(config: &Config) -> Self

Customized constructor with:

  • [Config::max_history_size()],
  • [Config::history_ignore_space()],
  • [Config::history_duplicates()].
fn iter(&self) -> impl DoubleEndedIterator<Item = &String> + '_

Return a forward iterator.

Trait Implementations

impl Default for FileHistory

fn default() -> FileHistory

impl History for FileHistory

fn get(&self, index: usize, dir: SearchDirection) -> Result<Option<SearchResult<'_>>>
fn add(&mut self, line: &str) -> Result<bool>
fn add_owned(&mut self, line: String) -> Result<bool>
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn set_max_len(&mut self, len: usize) -> Result<()>
fn ignore_dups(&mut self, yes: bool) -> Result<()>
fn ignore_space(&mut self, yes: bool)
fn save(&mut self, path: &Path) -> Result<()>
fn append(&mut self, path: &Path) -> Result<()>
fn load(&mut self, path: &Path) -> Result<()>
fn clear(&mut self) -> Result<()>
fn search(&self, term: &str, start: usize, dir: SearchDirection) -> Result<Option<SearchResult<'_>>>
fn starts_with(&self, term: &str, start: usize, dir: SearchDirection) -> Result<Option<SearchResult<'_>>>

impl Index<usize> for FileHistory

type Output = String;
fn index(&self, index: usize) -> &String

Auto Trait Implementations

impl Freeze for FileHistory

impl RefUnwindSafe for FileHistory

impl Send for FileHistory

impl Sync for FileHistory

impl Unpin for FileHistory

impl UnsafeUnpin for FileHistory

impl UnwindSafe for FileHistory

Blanket Implementations

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for FileHistory where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for FileHistory where T: ?Sized,

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

impl<T> From<T> for FileHistory

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for FileHistory where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for FileHistory where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for FileHistory where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>