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

Stateful history that allows up/down-arrow browsing with an internal cursor.

Can optionally be associated with a newline separated history file using the FileBackedHistory::with_file() constructor. Similar to bash’s behavior without HISTTIMEFORMAT. (See https://www.gnu.org/software/bash/manual/html_node/Bash-History-Facilities.html) If the history is associated to a file all new changes within a given history capacity will be written to disk when History is dropped.

Implementations

Creates a new in-memory history that remembers n <= capacity elements

Panics

If capacity == usize::MAX

Creates a new history with an associated history file.

History file format: commands separated by new lines. If file exists file will be read otherwise empty file will be created.

Side effects: creates all nested directories to the file

Trait Implementations

Formats the value using the given formatter. Read more

Creates an in-memory History with a maximal capacity of HISTORY_SIZE.

To create a History that is synchronized with a file use FileBackedHistory::with_file()

On drop the content of the History will be written to the file if specified via FileBackedHistory::with_file().

Appends an entry if non-empty and not repetition of the previous entry. Resets the browsing cursor to the default state in front of the most recent entry.

Writes unwritten history contents to disk.

If file would exceed capacity truncates the oldest entries.

Reset the internal browsing cursor

Chronologic interaction over all entries present in the history

This moves the cursor backwards respecting the navigation query that is set Read more

This moves the cursor forwards respecting the navigation-query that is set Read more

Returns the string (if present) at the cursor

Set a new navigation mode for search based on input query defined in HistoryNavigationQuery Read more

Poll the current HistoryNavigationQuery mode

Query the values in the history entries

Max number of values that can be queried from the history

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.