pub struct Script { /* private fields */ }Expand description
§A compiled script
To evaluate a script, you must first compile its textual representation into
an instance of this struct, using Script::compile. Afterwards, you can
evaluate the script using Eval.
Implementations§
Source§impl Script
impl Script
Sourcepub fn compile(script: &str) -> Self
pub fn compile(script: &str) -> Self
§Compile the source text of a script into an instance of Script
Sourcepub fn map_operator_to_source(
&self,
operator: &OperatorIndex,
) -> Result<Range<usize>, InvalidOperatorIndex>
pub fn map_operator_to_source( &self, operator: &OperatorIndex, ) -> Result<Range<usize>, InvalidOperatorIndex>
§Map the operator identified by the provided index to the source code
The returned range can be used to index into the source string
originally provided to Script::compile, to get the sub-string that
was compiled into the operator identified by the provided index.
Returns None, if the provided OperatorIndex does not refer to an
operator in the script.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Script
impl RefUnwindSafe for Script
impl Send for Script
impl Sync for Script
impl Unpin for Script
impl UnsafeUnpin for Script
impl UnwindSafe for Script
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
Mutably borrows from an owned value. Read more