pub struct ViceroyService { /* private fields */ }
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", ProfilingStrategy::None)?;
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

Responses given by the service.
Errors produced by the service.
The future response value.
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

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Query the “status” flags for the self file descriptor.
Create a new SetFdFlags value for use with set_fd_flags. Read more
Set the “status” flags for the self file descriptor. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
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