// A compiler experiment: a Nikaia program calls a Rust crate that starts its // own threads and event loop, serves one HTTP request, and hands a `String` to // one of those threads. // // cd examples/foreign-runtime/serve // nikaia run // // It is meant to print: // // served: GET /hello on tokio-rt-worker // crossed: a String is Send on tokio-rt-worker, called from main // // The literal reaches Rust as a `String`: `across_a_thread`'s `T` is decided // by this argument alone, and a text literal is `String`. The first build // fetches `hyper` and `tokio` from crates.io. // // It checks that this works at all. Nothing in the source shows that the calls // start threads, and nothing in the language lets it say so. fn main() { let served = hyper_shim::serve_once(18080) println(f"served: {served}") let crossed = hyper_shim::across_a_thread("a String is Send") println(f"crossed: {crossed}") }