main
#[main]Main function attribute for a Compute program.
Usage
This attribute should be applied to a main function that takes a request and returns a
response or an error. For example:
use fastly::{Error, Request, Response};
#[fastly::main]fn main(ds_req: Request) -> Result<Response, Error> { Ok(ds_req.send("example_backend")?)}You can apply #[fastly::main] to any function that takes Request as its sole argument, and
returns a Result<Response, Error>.
More Information
This is a convenience to abstract over the common usage of Request::from_client() and
Response::send_to_client() at the beginning and end of a program's main() function. The
macro use above is equivalent to the following code:
12345678use fastly::{Error, Request};
fn main() -> Result<(), Error> { let ds_req = Request::from_client(); let us_resp = ds_req.send("example_backend")?; us_resp.send_to_client(); Ok(())}