Struct ketos::buffer::CodeBuffer
[−]
[src]
pub struct CodeBuffer { /* fields omitted */ }
Buffers potentially incomplete input code
Methods
impl CodeBuffer
[src]
fn new() -> CodeBuffer
Creates a CodeBuffer
with an empty buffer
fn clear(&mut self)
Clears the input buffer.
fn feed_compile(
&mut self,
interp: &Interpreter,
input: &str
) -> Result<MoreResult<Vec<Code>>, Error>
&mut self,
interp: &Interpreter,
input: &str
) -> Result<MoreResult<Vec<Code>>, Error>
Feeds some input to the buffer.
Input should be terminated with a newline ('\n'
).
Compilation will be attempted with the given interpreter. If parsing
fails because more input is required, Ok(MoreResult::More(_))
will be returned, indicating the reason input is incomplete.
If some other error is encountered, it is returned. Otherwise,
Ok(MoreResult::Complete(_))
is returned with compiled expressions.
If either Ok(MoreResult::Complete(_))
or Err(_)
is returned,
the input buffer is cleared after compiling.
fn feed_parse(
&mut self,
interp: &Interpreter,
input: &str
) -> Result<MoreResult<Vec<Value>>, Error>
&mut self,
interp: &Interpreter,
input: &str
) -> Result<MoreResult<Vec<Value>>, Error>
Feeds some input to the buffer.
Like feed_compile
, but the input is only parsed.
Trait Implementations
impl Clone for CodeBuffer
[src]
fn clone(&self) -> CodeBuffer
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more