Skip to content

Instantly share code, notes, and snippets.

@bstrie
Created May 22, 2014 00:45
Show Gist options
  • Save bstrie/ef677f8e0c2fe9c91609 to your computer and use it in GitHub Desktop.
Save bstrie/ef677f8e0c2fe9c91609 to your computer and use it in GitHub Desktop.
use Foo::Bar;
mod Foo {
pub struct Bar {
pub x: int,
y: int
}
impl Bar {
pub fn new(new_x: int, new_y: int) -> Bar {
Bar { x: new_x, y: new_y }
}
}
}
impl Bar {
fn set_x(&self, new_x: int) {
self.x = new_x;
}
}
fn main() {
let bar = Bar::new(1, 2); // error: unresolved name `Bar::new`.
println!("{}", bar.x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment