Can’t understand Rust module system

Short answer: you don’t need the mod phone in phone.rs. Just remove that and your code will work (assuming the rest of the code is correct). Longer answer: The following code in main.rs: pub mod phone; is equivalent to: pub mod phone { // literally insert the contents of phone.rs here } so you don’t … Read more

When do I need a triple slash reference?

You need a triple slash reference in two scenarios: When you are referencing JavaScript type definitions e.g. definitions for node, jQuery, etc. for a great collection see : https://github.com/DefinitelyTyped/DefinitelyTyped When we want to compile using –out you can reference your files using /// <reference. You need a import/require combo when using external modules i.e. amd/commonjs. … Read more

Unbound Graphics Module

This error also appears often on Mac OS X. With Homebrew this module is disabled by default on installation, so brew install ocaml will not install the Graphics module, probably due to the XQuartz dependency. If you run brew info ocaml, it will tell you that there’s a flag, namely –with-x11, that will “Install with … Read more

ES6 export all values from object

I can’t really recommend this solution work-around but it does function. Rather than exporting an object, you use named exports each member. In another file, import the first module’s named exports into an object and export that object as default. Also export all the named exports from the first module using export * from ‘./file1’; … Read more