Struct viceroy_lib::ExecuteCtx [−][src]
pub struct ExecuteCtx { /* fields omitted */ }
Expand description
Execution context used by a ViceroyService
.
This is all of the state needed to instantiate a module, in order to respond to an HTTP
request. Note that it is very important that ExecuteCtx
be cheaply clonable, as it is cloned
every time that a viceroy service handles an incoming connection.
Implementations
Create a new execution context, given the path to a module.
Set the backends for this execution context.
Get the dictionaries for this execution context.
Set the dictionaries for this execution context.
Set the path to the config for this execution context.
Whether to treat stdout as a logging endpoint.
Set the stdout logging policy for this execution context.
Whether to treat stderr as a logging endpoint.
Set the stderr logging policy for this execution context.
Gets the TLS configuration
Asynchronously handle a request.
This method fully instantiates the wasm module housed within the ExecuteCtx
,
including running the wasm start function. It then proceeds to execute the
instantiated module’s WASI entry point, running to completion. If execution
results in an error, a response is still produced, but with a 500 status code.
Build time: Before you build or test your code, we recommend to set the release flag
e.g. cargo test --release
otherwise the execution will be very slow. This has to do
with the Cranelift compiler, which is extremely slow when compiled in debug mode.
Example
let ctx = ExecuteCtx::new("path/to/a/file.wasm")?;
let resp = ctx.handle_request(req, "127.0.0.1".parse().unwrap()).await?;
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for ExecuteCtx
impl Send for ExecuteCtx
impl Sync for ExecuteCtx
impl Unpin for ExecuteCtx
impl !UnwindSafe for ExecuteCtx
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn get_fd_flags(&self) -> Result<FdFlags, Error> where
T: AsFilelike,
pub fn get_fd_flags(&self) -> Result<FdFlags, Error> where
T: AsFilelike,
Query the “status” flags for the self
file descriptor.
pub fn new_set_fd_flags(
&self,
fd_flags: FdFlags
) -> Result<SetFdFlags<T>, Error> where
T: AsFilelike,
pub fn new_set_fd_flags(
&self,
fd_flags: FdFlags
) -> Result<SetFdFlags<T>, Error> where
T: AsFilelike,
Create a new SetFdFlags
value for use with set_fd_flags
. Read more
pub fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error> where
T: AsFilelike,
pub fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error> where
T: AsFilelike,
Set the “status” flags for the self
file descriptor. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more