Created
May 4, 2015 16:50
-
-
Save gyscos/42510a335098ce935848 to your computer and use it in GitHub Desktop.
Failed example of accessible immutable ref from Nickel.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[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