Crate land_sdk_macro
source ·Expand description
Rust SDK Macro for Runtime.land.
This macro is used to develop Runtime.land functions in land-sdk
.
It should not be used directly.
Hello World
use land_sdk::http::{Body, Request, Response};
use land_sdk::http_main;
#[http_main]
pub fn handle_request(req: Request) -> Response {
// read uri and method from request
let url = req.uri().clone();
let method = req.method().to_string().to_uppercase();
// build response
http::Response::builder()
.status(200)
.header("X-Request-Url", url.to_string())
.header("X-Request-Method", method)
.body(Body::from("Hello Runtime.land!!"))
.unwrap()
}
Attribute Macros
- http_main is a macro to generate a http handler function.