pub struct Editor<B: Buffer, H: History> { /* private fields */ }Expand description
Line editor for async IO
It is recommended to use crate::builder::EditorBuilder to build an editor.
Implementations§
Source§impl<B, H> Editor<B, H>
impl<B, H> Editor<B, H>
Sourcepub async fn new<IO: Read + Write>(
buffer: LineBuffer<B>,
history: H,
_io: &mut IO,
) -> Result<Self, NolineError>
pub async fn new<IO: Read + Write>( buffer: LineBuffer<B>, history: H, _io: &mut IO, ) -> Result<Self, NolineError>
Create and initialize line editor
Sourcepub async fn readline<'b, 'item, IO, I>(
&'b mut self,
prompt: impl Into<Prompt<I>>,
io: &mut IO,
) -> Result<&'b str, NolineError>
pub async fn readline<'b, 'item, IO, I>( &'b mut self, prompt: impl Into<Prompt<I>>, io: &mut IO, ) -> Result<&'b str, NolineError>
Read line from stdin
Sourcepub fn load_history<'a>(
&mut self,
entries: impl Iterator<Item = &'a str>,
) -> usize
pub fn load_history<'a>( &mut self, entries: impl Iterator<Item = &'a str>, ) -> usize
Load history from iterator
Sourcepub fn get_history(&self) -> impl Iterator<Item = CircularSlice<'_>>
pub fn get_history(&self) -> impl Iterator<Item = CircularSlice<'_>>
Get history as iterator over circular slices
Auto Trait Implementations§
impl<B, H> Freeze for Editor<B, H>
impl<B, H> RefUnwindSafe for Editor<B, H>where
H: RefUnwindSafe,
B: RefUnwindSafe,
impl<B, H> Send for Editor<B, H>
impl<B, H> Sync for Editor<B, H>
impl<B, H> Unpin for Editor<B, H>
impl<B, H> UnwindSafe for Editor<B, H>where
H: UnwindSafe,
B: UnwindSafe,
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