Skip to content

Instantly share code, notes, and snippets.

@cceckman
Created February 25, 2014 18:33
Show Gist options
  • Select an option

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

Select an option

Save cceckman/9214876 to your computer and use it in GitHub Desktop.
Method calls in Rust
trait ScreenCanvas{
fn sync(&Self) -> bool;
fn setResolution(&Self) -> bool;
}
struct screen_buffer_info{
x : uint;
}
impl ScreenCanvas for screen_buffer_info{
fn sync(&self) -> bool{
true
}
fn setResolution(&self) -> bool{
self.sync()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment