[−][src]Struct papyrus::repl::Repl
The repl structure. Stored as a state machine. See the [module level documentation] for more information.
A repl has different available methods depending on its state.
Fields
data: ReplData<Data>
The inner repl configuration data.
Implementations
impl<S, D> Repl<S, D>
[src]
These methods are available in any REPL state.
pub fn prompt(&self, colour: bool) -> String
[src]
The prompt.
Includes the module name, the editing/mutating state, the command path, the input symbol, and the trailing space. It also includes the colouring byte sequences if specified.
impl<D> Repl<Evaluate, D>
[src]
These methods are available when the REPL is in the
Evaluate
state.
pub fn eval(self, app_data: &mut D) -> EvalResult<D>
[src]
Evaluates the read input, compiling and executing the code and printing all line prints until a result is found. This result gets passed back as a print ready repl.
pub fn eval_async(self, app_data: &Arc<Mutex<D>>) -> Evaluating<D> where
D: 'static + Send,
[src]
D: 'static + Send,
Same as eval
but will evaluate on another thread, not blocking this one.
An Arc::clone
will be taken of app_data
.
pub fn output_listen(&mut self) -> Receiver
[src]
Begin listening to line change events on the output.
pub fn close_channel(&mut self)
[src]
Close the sender side of the output channel.
pub fn output(&self) -> &str
[src]
The current output.
The output contains colouring ANSI escape codes, the prompt, and all input.
impl<D> Repl<Print, D>
[src]
These methods are available when the REPL is in the
pub fn print(self) -> (Repl<Read, D>, Option<(usize, Kserd<'static>)>)
[src]
Prints the result if successful as [out#]
or the failure message if any.
Uses the default formatter for the Kserd
data.
pub fn print_with_formatting(
self,
config: FormattingConfig
) -> (Repl<Read, D>, Option<(usize, Kserd<'static>)>)
[src]
self,
config: FormattingConfig
) -> (Repl<Read, D>, Option<(usize, Kserd<'static>)>)
Prints the result if successful as [out#]
or the failure message if any.
Uses the given formatting configuration for the Kserd
data.
The return is (
impl<D> Repl<Read, D>
[src]
These methods are available when the REPL is in the
Read
state.
pub fn line_input(&mut self, input: &str)
[src]
Overwrite the current line in the input buffer.
A line is considered if more input is required, the previous input stacked. Only overwrites the most recent buffer.
pub fn input_buffer(&self) -> &str
[src]
The current input buffer.
pub fn input_buffer_line(&self) -> &str
[src]
The line of the current input buffer.
This differs to the input buffer if there has been a requirement for
More
input, say if a block {
was started and not closed out. The
line is what has be set with line_input
.
pub fn read(self) -> ReadResult<D>
[src]
Read the current contents of the input buffer. This may move the repl into an evaluating state.
pub fn output(&self) -> &str
[src]
The current output.
The output contains colouring ANSI escape codes, the prompt, and all input.
pub fn output_listen(&mut self) -> Receiver
[src]
Begin listening to line change events on the output.
pub fn close_channel(&mut self)
[src]
Close the sender side of the output channel.
impl<D> Repl<Read, D>
[src]
Available with the runnable
feature and when the REPL is in the Read
state.
pub fn run<T, U, V>(
self,
run_callbacks: RunCallbacks<D, T, U, V>
) -> Result<String> where
T: FnMut(&Repl<Print, D>) -> FormattingConfig,
U: FnMut(usize, Kserd<'static>, &Repl<Read, D>),
V: FnOnce(&mut ReplData<D>, &mut D),
[src]
self,
run_callbacks: RunCallbacks<D, T, U, V>
) -> Result<String> where
T: FnMut(&Repl<Print, D>) -> FormattingConfig,
U: FnMut(usize, Kserd<'static>, &Repl<Read, D>),
V: FnOnce(&mut ReplData<D>, &mut D),
Run the repl inside the terminal, consuming the repl. Returns the output of the REPL.
Trait Implementations
Auto Trait Implementations
impl<S, Data> RefUnwindSafe for Repl<S, Data> where
Data: RefUnwindSafe,
S: RefUnwindSafe,
Data: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, Data> Send for Repl<S, Data> where
Data: Send,
S: Send,
Data: Send,
S: Send,
impl<S, Data> Sync for Repl<S, Data> where
Data: Sync,
S: Sync,
Data: Sync,
S: Sync,
impl<S, Data> Unpin for Repl<S, Data> where
Data: Unpin,
S: Unpin,
Data: Unpin,
S: Unpin,
impl<S, Data> UnwindSafe for Repl<S, Data> where
Data: UnwindSafe,
S: UnwindSafe,
Data: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> MaybeResult<T> for T
[src]
type Error = !
fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T
[src]
fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>
[src]
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<E> SpecializationError for E
[src]
default fn not_found<S, T>(
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
[src]
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,