This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub trait Eq { | |
fn eq(&self, other: &Self) -> bool; | |
} | |
// equality operators are wired to this trait | |
#[lang = "partial_eq"] | |
pub trait PartialEq { | |
fn eq(&self, other: &Self) -> bool; | |
fn ne(&self, other: &Self) -> bool; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[feature(macro_rules)]; | |
use spec::test; | |
#[macro_escape] | |
mod spec { | |
macro_rules! my_macro ( | |
() => (println!("hello")); | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[feature(macro_rules)]; | |
use spec::test; | |
use spec::my_macro; | |
#[feature(macro_escape)] | |
mod spec { | |
#[macro_export] | |
macro_rules! my_macro ( | |
() => (println!("hello")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::util; | |
enum List { | |
Cons(int, ~List), | |
Nil | |
} | |
impl List { | |
fn prepend(&mut self, x : int) { | |
let new = ~util::replace(self, Nil); | |
*self = Cons(x, new); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub trait ApplicationDelegate { | |
fn application_did_quit(&mut self, _timestamp: u32) {} | |
} | |
pub struct MouseMotionEventInfo; | |
pub struct MouseButtonEventInfo; | |
pub struct MouseWheelEventInfo; | |
pub trait MouseDelegate { | |
fn mouse_did_move(&mut self, _info: &MouseMotionEventInfo) {} |