Skip to content

Instantly share code, notes, and snippets.

@trimoq
Created October 21, 2019 08:59
Show Gist options
  • Save trimoq/7e9701144cc4b26237ae011e6f3b6472 to your computer and use it in GitHub Desktop.
Save trimoq/7e9701144cc4b26237ae011e6f3b6472 to your computer and use it in GitHub Desktop.
Expanded sample behemoth
#![feature(prelude_import)]
#![no_std]
#![feature(proc_macro_hygiene, decl_macro)]
#[prelude_import]
use ::std::prelude::v1::*;
#[macro_use]
extern crate std as std;
#[macro_use]
extern crate rocket;
fn hello(name: String) -> String {
::alloc::fmt::format(::core::fmt::Arguments::new_v1(
&["hello "],
&match (&name,) {
(arg0,) => [::core::fmt::ArgumentV1::new(
arg0,
::core::fmt::Display::fmt,
)],
},
))
}
/// Rocket code generated wrapping route function.
fn rocket_route_fn_hello<'_b>(
__req: &'_b ::rocket::Request,
__data: ::rocket::Data,
) -> ::rocket::handler::Outcome<'_b> {
#[allow(non_snake_case, unreachable_patterns, unreachable_code)]
let __rocket_param_name: String = match __req.raw_segment_str(1usize) {
Some(__s) => match <String as ::rocket::request::FromParam>::from_param(__s) {
Ok(__v) => __v,
Err(__error) => {
return {
::rocket::logger::warn_(&::alloc::fmt::format(::core::fmt::Arguments::new_v1(
&["Failed to parse \'", "\': "],
&match (&"__rocket_param_name", &__error) {
(arg0, arg1) => [
::core::fmt::ArgumentV1::new(arg0, ::core::fmt::Display::fmt),
::core::fmt::ArgumentV1::new(arg1, ::core::fmt::Debug::fmt),
],
},
)));
::rocket::Outcome::Forward(__data)
}
}
},
None => {
return {
::rocket::logger::error(
"Internal invariant error: expected dynamic parameter not found.",
);
::rocket::logger::error("Please report this error to the Rocket issue tracker.");
::rocket::Outcome::Forward(__data)
}
}
};
let ___responder = hello(__rocket_param_name);
::rocket::handler::Outcome::from(__req, ___responder)
}
/// Rocket code generated wrapping URI macro.
macro rocket_uri_macro_hello { ( $ ( $ token : tt ) * ) => { { extern crate std ; extern crate rocket ; rocket :: rocket_internal_uri ! ( "/hello/<name>" , ( name : String ) , $ ( $ token ) * ) } } }
/// Rocket code generated static route info.
#[allow(non_upper_case_globals)]
static static_rocket_route_info_for_hello: ::rocket::StaticRouteInfo = ::rocket::StaticRouteInfo {
name: "hello",
method: ::rocket::http::Method::Get,
path: "/hello/<name>",
handler: rocket_route_fn_hello,
format: None,
rank: None,
};
fn main() {
rocket::ignite()
.mount("/", {
let __vector: Vec<::rocket::Route> =
<[_]>::into_vec(box [::rocket::Route::from(&static_rocket_route_info_for_hello)]);
__vector
})
.launch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment