Struct noline::sync::Editor

source ·
pub struct Editor<B: Buffer, H: History, IO: Read + Write> { /* private fields */ }
Expand description

Line editor for synchronous IO

It is recommended to use crate::builder::EditorBuilder to build an Editor.

Implementations§

source§

impl<B, H, IO, RE, WE> Editor<B, H, IO>
where B: Buffer, H: History, IO: Read<Error = RE> + Write<Error = WE>,

source

pub fn new(io: &mut IO) -> Result<Self, Error<RE, WE>>

Create and initialize line editor

source

pub fn readline<'b>( &'b mut self, prompt: &'b str, io: &mut IO, ) -> Result<&'b str, Error<RE, WE>>

Read line from stdin

source

pub fn load_history<'a>( &mut self, entries: impl Iterator<Item = &'a str>, ) -> usize

Load history from iterator

source

pub fn get_history<'a>(&'a self) -> impl Iterator<Item = CircularSlice<'a>>

Get history as iterator over circular slices

Auto Trait Implementations§

§

impl<B, H, IO> Freeze for Editor<B, H, IO>
where H: Freeze, B: Freeze,

§

impl<B, H, IO> RefUnwindSafe for Editor<B, H, IO>

§

impl<B, H, IO> Send for Editor<B, H, IO>
where H: Send, B: Send, IO: Send,

§

impl<B, H, IO> Sync for Editor<B, H, IO>
where H: Sync, B: Sync, IO: Sync,

§

impl<B, H, IO> Unpin for Editor<B, H, IO>
where H: Unpin, B: Unpin, IO: Unpin,

§

impl<B, H, IO> UnwindSafe for Editor<B, H, IO>
where H: UnwindSafe, B: UnwindSafe, IO: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.