Skip to content

Instantly share code, notes, and snippets.

@cceckman
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save cceckman/9245947 to your computer and use it in GitHub Desktop.

Select an option

Save cceckman/9245947 to your computer and use it in GitHub Desktop.
use self::arm1176jzf_s::gpio::pin_mode::OUTPUT;
// Compilation error: cannot import from a trait or type implementation
pub mod arm1176jzf_s;
// Defined with submodules in separate file
pub fn init() {
let p : Pin = arm1176jzf_s::gpio::Pin::get(16);
p.setMode(OUTPUT);
// setMode has a single parameter of type arm1176jzf_s::gpio::pin_mode; OUTPUT is a variant thereof
// Even with "use" above removed, this gives an error- rustc doesn't recognize the name OUTPUT
p.write(p, false);
}
@cceckman

Copy link
Copy Markdown
Author

Resolution: OUTPUT is in the gpio namespace, not a pin_mode namespace. So use self::arm1176jzf_s::gpio lets us then refer to gpio::OUTPUT unambiguously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment