Struct brane_shr::input::FileHistory
source · pub struct FileHistory { /* private fields */ }
Expand description
Defines a history that relates to a particular file.
Will automatically write-back on dropping.
Implementations§
source§impl FileHistory
impl FileHistory
sourcepub fn new(path: impl Into<PathBuf>) -> Self
pub fn new(path: impl Into<PathBuf>) -> Self
Constructor for the FileHistory.
Attempts to read the history from the given path
, and writes it back when this struct is dropped (unless Self::forget()
is called). To this end, avoid having two FileHistory’s that point to the same file.
§Arguments
path
: Points to the location of this history’s file.
§Returns
A new FileHistory instance.
§Warnings
This function emits warnings using warn!()
when it fails to read the file.
Trait Implementations§
source§impl Clone for FileHistory
impl Clone for FileHistory
source§fn clone(&self) -> FileHistory
fn clone(&self) -> FileHistory
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for FileHistory
impl Debug for FileHistory
source§impl Drop for FileHistory
impl Drop for FileHistory
source§impl History<String> for FileHistory
impl History<String> for FileHistory
source§fn read(&self, pos: usize) -> Option<String>
fn read(&self, pos: usize) -> Option<String>
This is called with the current position that should
be read from history. The
pos
represents the number
of times the Up
/Down
arrow key has been pressed.
This would normally be used as an index to some sort
of vector. If the pos
does not have an entry, None
should be returned.Auto Trait Implementations§
impl Freeze for FileHistory
impl RefUnwindSafe for FileHistory
impl Send for FileHistory
impl Sync for FileHistory
impl Unpin for FileHistory
impl UnwindSafe for FileHistory
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request