Skip to content

Instantly share code, notes, and snippets.

@flosse flosse/Cargo.toml
Created Jul 27, 2016

Embed
What would you like to do?
iron-write-to-body
[package]
name = "iron-wirte-to-body"
version = "0.1.0"
authors = ["Markus Kohlhase <mail@markus-kohlhase.de>"]
[dependencies]
iron = "*"
maud = "*"
maud_macros = "*"
#![feature(plugin)]
#![plugin(maud_macros)]
extern crate iron;
extern crate maud;
use iron::prelude::*;
use iron::status;
fn main() {
fn write_to_body(_: &mut Request) -> IronResult<Response> {
let world = "world";
let res = Response::new();
let mut body_buffer:Vec<u8> = vec!(); // <-- how to connect it to 'res'?
html_utf8!(body_buffer, {
html {
body {
h1 "Write to body!"
p "Hello " ^world "!"
}
}
}).unwrap();
Ok(Response::with((status::Ok, "Hello World!")))
}
Iron::new(write_to_body).http("localhost:3000").unwrap();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.