4 ms·
This is the same in even many dynamic languages, though, isn't it?
by Jweb_Guru 11y ago
This is the same in even many dynamic languages, though, isn't it?
- viraptor 11y agoAlmost. 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; ...