This file contains hidden or 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
struct Resource(int); | |
struct Owner | |
{ | |
target: ~Resource | |
} | |
impl Owner | |
{ | |
fn set_target(&mut self, new_target: ~Resource) |
This file contains hidden or 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
#[start] | |
fn start(argc: int, argv: **u8, crate_map: *u8) -> int | |
{ | |
allegro::run(argc, argv, crate_map, main) | |
} | |
fn main() | |
{ | |
let mut disp = allegro::Display::new(800, 600).unwrap(); | |
let bmp = ~allegro::Bitmap::new(256, 256).unwrap(); |
This file contains hidden or 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
mod foo | |
{ | |
struct A; | |
} | |
mod bar | |
{ | |
struct B | |
{ | |
a: foo::A |
This file contains hidden or 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 extension::*; | |
macro_rules! flag_type | |
( | |
(mod $m:ident { $f: ident { $($n: ident = $v: expr),*} }) => | |
{ | |
pub mod $m | |
{ | |
pub struct $f | |
{ |
This file contains hidden or 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
fn main() | |
{ | |
let a = NumType(7) /and/ (NumType(2) /and/ NumType(3)); | |
println!("{}", *a); | |
} | |
struct NumType(int); | |
struct AndHelper | |
{ |
This file contains hidden or 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
rustc --lib test1.rs | |
warning: missing crate link meta `name`, using `test1` as default | |
warning: missing crate link meta `vers`, using `0.0` as default | |
rustc test2.rs -L. | |
test2.rs:16:10: 16:12 error: `C2` does not name a structure | |
test2.rs:16 let c2 = C2{a: 0}; | |
^~ | |
error: aborting due to previous error |
This file contains hidden or 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
struct A | |
{ | |
x: int | |
} | |
struct B<'self> | |
{ | |
a: &'self mut A | |
} |
This file contains hidden or 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 A::B; | |
pub mod A | |
{ | |
mod B | |
{ | |
} | |
} |
This file contains hidden or 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 B::*; | |
pub struct S; | |
mod B | |
{ | |
impl super::S | |
{ | |
fn new() | |
{ | |
super::S |
This file contains hidden or 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 struct S; | |
mod private | |
{ | |
impl super::S | |
{ | |
fn test(&self) | |
{ | |
} | |
} |