pub struct ScriptRewriter { /* private fields */ }Expand description
Pre-compiled Rhai script used as a per-match replacement callback.
Implementations§
Source§impl ScriptRewriter
impl ScriptRewriter
Sourcepub fn from_source(source: &str) -> Result<Self>
pub fn from_source(source: &str) -> Result<Self>
Compile source directly. Returns Error::ScriptParse on
syntax errors.
Sourcepub fn fresh(&self) -> Self
pub fn fresh(&self) -> Self
Build a sibling rewriter that shares the compiled AST with self
but owns a fresh sandboxed engine. Rhai Engine is !Sync, so
parallel pipelines that want to evaluate the same script on
multiple worker threads call fresh() per worker (e.g. via
rayon::par_iter().map_init(|| script.fresh(), ...)).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ScriptRewriter
impl !RefUnwindSafe for ScriptRewriter
impl Send for ScriptRewriter
impl Sync for ScriptRewriter
impl Unpin for ScriptRewriter
impl UnsafeUnpin for ScriptRewriter
impl !UnwindSafe for ScriptRewriter
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more