Struct noline::builder::EditorBuilder

source ·
pub struct EditorBuilder<B: Buffer, H: History> { /* private fields */ }
Expand description

Builder for sync::Editor and no_sync::tokio::Editor.

§Example

use noline::builder::EditorBuilder;

let mut editor = EditorBuilder::new_static::<100>()
    .with_static_history::<200>()
    .build_sync(&mut io)
    .unwrap();

Implementations§

source§

impl EditorBuilder<NoBuffer, NoHistory>

source

pub fn new_static<const N: usize>() -> EditorBuilder<StaticBuffer<N>, NoHistory>

Create builder for editor with static buffer

§Example
use noline::builder::EditorBuilder;

let builder = EditorBuilder::new_static::<100>();
source

pub fn new_unbounded() -> EditorBuilder<UnboundedBuffer, NoHistory>

Create builder for editor with unbounded buffer

§Example
use noline::builder::EditorBuilder;

let builder = EditorBuilder::new_unbounded();
source§

impl<B: Buffer, H: History> EditorBuilder<B, H>

source

pub fn with_static_history<const N: usize>( self, ) -> EditorBuilder<B, StaticHistory<N>>

Add static history

source

pub fn with_unbounded_history(self) -> EditorBuilder<B, UnboundedHistory>

Add unbounded history

source

pub fn build_sync<IO, RE, WE>( self, io: &mut IO, ) -> Result<Editor<B, H, IO>, Error<RE, WE>>
where IO: Read<Error = RE> + Write<Error = WE>,

Build sync::Editor. Is equivalent of calling sync::Editor::new().

source

pub async fn build_async_tokio<W: AsyncWriteExt + Unpin, R: AsyncReadExt + Unpin>( self, stdin: &mut R, stdout: &mut W, ) -> Result<Editor<B, H>, Error<Error, Error>>

Build no_sync::tokio::Editor. Is equivalent of calling no_sync::tokio::Editor::new().

Auto Trait Implementations§

§

impl<B, H> Freeze for EditorBuilder<B, H>

§

impl<B, H> RefUnwindSafe for EditorBuilder<B, H>

§

impl<B, H> Send for EditorBuilder<B, H>
where B: Send, H: Send,

§

impl<B, H> Sync for EditorBuilder<B, H>
where B: Sync, H: Sync,

§

impl<B, H> Unpin for EditorBuilder<B, H>
where B: Unpin, H: Unpin,

§

impl<B, H> UnwindSafe for EditorBuilder<B, H>
where B: UnwindSafe, H: 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.