News for hackers. Stuff that matters.
Re:Writing a website in Rust by viraptor on Saturday May 30, 2015 @02:51PM (#9631309)
For use, I meant that there are so many packages you just take space just listing them. For basic iron you need: iron::prelude::*, iron::status, staticfile, logger, router, handlebars_iron, and more. And these are all from different crates.
Re:Writing a website in Rust by Jweb_Guru on Saturday May 30, 2015 @03:17PM (#9631414)
This is the same in even many dynamic languages, though, isn't it?
Re:Writing a website in Rust by viraptor on Sunday May 31, 2015 @01:07AM (#9633166)
Almost. In Rust to use a trait, you have to explicitly import it. That means if you want to run `.to_json()` on something, you need to import trait `ToJson`. Then again if you want to force a type of something (for example an empty hashmap) you need to import the types which are included.

So what in a dynamic language could be:

    a.to_json() if a else {}.to_json()
In rust will start with:

    use rustc_serialize::json::{ToJson,Json};
    use std::collections::BTreeMap;
    ...