Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gyscos
Created May 4, 2015 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gyscos/42510a335098ce935848 to your computer and use it in GitHub Desktop.
Save gyscos/42510a335098ce935848 to your computer and use it in GitHub Desktop.
Failed example of accessible immutable ref from Nickel.rs
#[macro_use]
extern crate nickel;
use nickel::Nickel;
struct MyObject;
impl MyObject {
fn foo(&self) {}
}
fn serve(obj: &MyObject) {
let mut server = Nickel::new();
server.utilize(router! {
get "/foo" => |_req, _res| {
obj.foo();
}
});
server.listen("127.0.0.1:6767");
}
fn main() {
let obj: MyObject;
serve(&obj);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment