Struct viceroy_lib::ViceroyService [−][src]
pub struct ViceroyService { /* fields omitted */ }
Expand description
A Viceroy service uses a Wasm module and a handler function to respond to HTTP requests.
This service type is used to compile a Wasm Module
, and perform the actions necessary
to initialize a Server
and bind the service to a local port.
Each time a connection is received, a RequestService
will be created, to
instantiate the module and return a Response
.
Implementations
Create a new Viceroy service, using the given handler function and module path.
Example
let ctx = ExecuteCtx::new("path/to/a/file.wasm")?;
let svc = ViceroyService::new(ctx);
Bind this service to the given address and start serving responses.
This will consume the service, using it to start a server that will execute the given module each time a new request is sent. This function will only return if an error occurs.
Trait Implementations
type Response = RequestService
type Response = RequestService
Responses given by the service.
type Error = Infallible
type Error = Infallible
Errors produced by the service.
Returns Poll::Ready(Ok(()))
when the service is able to process requests. Read more
Process the request and return the response asynchronously. Read more
Auto Trait Implementations
impl !RefUnwindSafe for ViceroyService
impl Send for ViceroyService
impl Sync for ViceroyService
impl Unpin for ViceroyService
impl !UnwindSafe for ViceroyService
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
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