Struct moon_script::engine::context::ContextBuilder
source · pub struct ContextBuilder { /* private fields */ }Expand description
Configures an Engine about a specific script to compile, this includes giving input variables
Implementations§
source§impl ContextBuilder
impl ContextBuilder
sourcepub fn push_variable<Variable: Into<InputVariable>>(
&mut self,
variable: Variable,
) -> (usize, usize)
pub fn push_variable<Variable: Into<InputVariable>>( &mut self, variable: Variable, ) -> (usize, usize)
Pushes an input variable, if said it’s constant, the AST will have its value inlined
sourcepub fn with_variable<Variable: Into<InputVariable>>(
self,
variable: Variable,
) -> ContextBuilder
pub fn with_variable<Variable: Into<InputVariable>>( self, variable: Variable, ) -> ContextBuilder
Adds an input variable, if said it’s constant, the AST will have its value inlined
sourcepub fn start_parsing_position_offset(
&mut self,
line_offset: usize,
column_offset: usize,
)
pub fn start_parsing_position_offset( &mut self, line_offset: usize, column_offset: usize, )
Specifies an starting position for this script, this is useful if you use a file with multiple scripts for managing error.
Example: If you had a file containing multiples scripts, and one was located on the line 100 and had a syntax / AST Parsing on it’s 3rd line, then the error will tell the error happens on line 103, instead of line 3.
sourcepub fn with_start_parsing_position_offset(
self,
line_offset: usize,
column_offset: usize,
) -> ContextBuilder
pub fn with_start_parsing_position_offset( self, line_offset: usize, column_offset: usize, ) -> ContextBuilder
Specifies an starting position for this script, this is useful if you use a file with multiple scripts for managing error.
Example: If you had a file containing multiples scripts, and one was located on the line 100 and had a syntax / AST Parsing on it’s 3rd line, then the error will tell the error happens on line 103, instead of line 3.
sourcepub fn parsing_column_fixed(&mut self, parsing_position_column_is_fixed: bool)
pub fn parsing_column_fixed(&mut self, parsing_position_column_is_fixed: bool)
Specifies it the column indicated in Self::with_start_parsing_position_offset is a fixed one or not.
Example: If you had a file containing a script, but it is idented by 4 spaces on every line, setting this to true and setting the column offset as 4 would make that errors happening on colum 4 would appear as they happened on column 0 instead, so if the error its on column 100, it would say the error starts at 96 instead.
sourcepub fn with_parsing_column_fixed(
self,
parsing_position_column_is_fixed: bool,
) -> ContextBuilder
pub fn with_parsing_column_fixed( self, parsing_position_column_is_fixed: bool, ) -> ContextBuilder
Specifies it the column indicated in Self::with_start_parsing_position_offset is a fixed one or not.
Example: If you had a file containing a script, but it is idented by 4 spaces on every line, setting this to true and setting the column offset as 4 would make that errors happening on colum 4 would appear as they happened on column 0 instead, so if the error its on column 100, it would say the error starts at 96 instead.
Trait Implementations§
source§impl AsRef<ContextBuilder> for ContextBuilder
impl AsRef<ContextBuilder> for ContextBuilder
source§fn as_ref(&self) -> &ContextBuilder
fn as_ref(&self) -> &ContextBuilder
source§impl Clone for ContextBuilder
impl Clone for ContextBuilder
source§fn clone(&self) -> ContextBuilder
fn clone(&self) -> ContextBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for ContextBuilder
impl Debug for ContextBuilder
Auto Trait Implementations§
impl Freeze for ContextBuilder
impl !RefUnwindSafe for ContextBuilder
impl Send for ContextBuilder
impl Sync for ContextBuilder
impl Unpin for ContextBuilder
impl !UnwindSafe for ContextBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)