pub struct Editor {
pub config: Config,
/* private fields */
}Expand description
Interactive line editor instance.
Fields§
§config: ConfigConfiguration for this editor instance.
Implementations§
Source§impl Editor
impl Editor
Sourcepub fn with_config(config: Config) -> Self
pub fn with_config(config: Config) -> Self
Creates a new editor with the specified configuration.
Sourcepub fn readline(
&mut self,
prompt: impl AsRef<BStr>,
) -> Result<BString, ReadlineError>
pub fn readline( &mut self, prompt: impl AsRef<BStr>, ) -> Result<BString, ReadlineError>
Reads a line from stdin/stdout using this editor.
Sourcepub fn readline_from<R: Read, W: Write>(
&mut self,
reader: R,
writer: W,
mode: OperatingMode,
prompt: impl AsRef<BStr>,
) -> Result<BString, ReadlineError>
pub fn readline_from<R: Read, W: Write>( &mut self, reader: R, writer: W, mode: OperatingMode, prompt: impl AsRef<BStr>, ) -> Result<BString, ReadlineError>
Reads a line from the provided reader and writer streams using the specified operating mode.
Sourcepub fn readline_stream<R: Read, W: Write>(
&mut self,
reader: &mut R,
writer: &mut W,
prompt: &BStr,
) -> Result<BString, ReadlineError>
pub fn readline_stream<R: Read, W: Write>( &mut self, reader: &mut R, writer: &mut W, prompt: &BStr, ) -> Result<BString, ReadlineError>
Reads a line directly from raw reader and writer streams in interactive mode.
Sourcepub fn set_completion_handler<H: CompletionHandler + 'static>(
&mut self,
handler: H,
)
pub fn set_completion_handler<H: CompletionHandler + 'static>( &mut self, handler: H, )
Registers a completion handler for tab autocompletion.
Sourcepub fn clear_completion_handler(&mut self)
pub fn clear_completion_handler(&mut self)
Removes any registered completion handler.
Sourcepub fn set_hint_handler<H: HintHandler + 'static>(&mut self, handler: H)
pub fn set_hint_handler<H: HintHandler + 'static>(&mut self, handler: H)
Registers a hint handler for inline completions/hints.
Sourcepub fn clear_hint_handler(&mut self)
pub fn clear_hint_handler(&mut self)
Removes any registered hint handler.
Sourcepub fn add_history(&mut self, line: impl Into<BString>) -> bool
pub fn add_history(&mut self, line: impl Into<BString>) -> bool
Adds a line to the editor’s history buffer.
Returns true if the entry was added (deduplicating adjacent identical entries).
Sourcepub fn history_mut(&mut self) -> &mut History
pub fn history_mut(&mut self) -> &mut History
Returns a mutable reference to the editor’s history manager.
Sourcepub fn clear_screen(&self) -> Result<(), Error>
pub fn clear_screen(&self) -> Result<(), Error>
Clears the terminal screen using stdout.