pub struct ScriptHandler { /* private fields */ }Expand description
A script-based HTTP handler.
Executes a Rhai script to handle HTTP requests.
Implementations§
Source§impl ScriptHandler
impl ScriptHandler
Sourcepub fn new(engine: Arc<RhaiEngine>, script_path: impl Into<PathBuf>) -> Self
pub fn new(engine: Arc<RhaiEngine>, script_path: impl Into<PathBuf>) -> Self
Create a new script handler.
Sourcepub async fn handle(&self, request: HttpRequest) -> Result<HttpResponse>
pub async fn handle(&self, request: HttpRequest) -> Result<HttpResponse>
Handle an HTTP request.
Sourcepub fn script_path(&self) -> &Path
pub fn script_path(&self) -> &Path
Get the script path.
Auto Trait Implementations§
impl Freeze for ScriptHandler
impl !RefUnwindSafe for ScriptHandler
impl Send for ScriptHandler
impl Sync for ScriptHandler
impl Unpin for ScriptHandler
impl !UnwindSafe for ScriptHandler
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> 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