Simple Example
// spooler.rs
spool_lib::spooler!(|_request: http::Request<&[u8]>| {
http::Response::new(b"Hello World".to_vec())
});
Storage Example
// spooler.rs
use http::{Method, Request, Response};
use spool_lib::host::kv;
spool_lib::spooler!(|request: Request<&[u8]>| {
Response::new(kv::get(request.uri()).ok().flatten().unwrap_or(b"").to_vec())
});
Outgoing Requests Example
// spooler.rs
spool_lib::spooler!(|request: http::Request<&[u8]>| {
spool_lib::host::http::request(
http::Request::builder()
.uri(*request.body())
.body(Vec::<u8>::new().as_slice())
.unwrap(),
)
.unwrap()
});