pub struct ScriptContext {
pub request: RequestBinding,
pub state: Arc<HashMap<String, Dynamic>>,
pub locals: HashMap<String, Dynamic>,
}Expand description
Context for script execution.
Provides access to request data, shared state, and utilities.
Fields§
§request: RequestBindingRequest binding.
state: Arc<HashMap<String, Dynamic>>Shared state accessible to scripts.
locals: HashMap<String, Dynamic>Request-scoped data.
Implementations§
Source§impl ScriptContext
impl ScriptContext
Sourcepub fn new(request: RequestBinding) -> Self
pub fn new(request: RequestBinding) -> Self
Create a new script context.
Sourcepub fn with_state(
request: RequestBinding,
state: Arc<HashMap<String, Dynamic>>,
) -> Self
pub fn with_state( request: RequestBinding, state: Arc<HashMap<String, Dynamic>>, ) -> Self
Create context with shared state.
Sourcepub fn into_scope(self) -> Scope<'static>
pub fn into_scope(self) -> Scope<'static>
Build a Rhai scope from this context.
Trait Implementations§
Source§impl Clone for ScriptContext
impl Clone for ScriptContext
Source§fn clone(&self) -> ScriptContext
fn clone(&self) -> ScriptContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ScriptContext
impl !RefUnwindSafe for ScriptContext
impl Send for ScriptContext
impl Sync for ScriptContext
impl Unpin for ScriptContext
impl !UnwindSafe for ScriptContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging