enum Fragment { Str(~str) } fn get_str(s: Fragment) -> ~str { match s { Str(s) => { s } } } fn generate_page(head: Fragment, body: Fragment) -> Fragment { Str("" + get_str(head) + get_str(body) + "") } fn get_head() -> Fragment { Str(~"") } fn get_body(s: Fragment) -> Fragment { Str("" + get_str(s) + "") } fn get_user_input(s: ~str) -> Fragment { Str(s) } fn render_page(s: Fragment) { println(get_str(s)); } fn bless(s: Fragment) -> Fragment { // Does some form of escaping here Str("" + get_str(s) + "") } fn main() { let user_input = get_user_input(~""); let page = generate_page(get_head(), get_body(user_input)); render_page(page); }