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
| void test_func(); | |
| int main() | |
| { | |
| test_func(); | |
| return 0; | |
| } |
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 { a : int } | |
| trait TA { } | |
| impl TA for A { } | |
| fn test_struct(a : &A) | |
| { | |
| } | |
| fn test_trait(a : &TA) |
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 Deferrer | |
| { | |
| df : ~fn() | |
| } | |
| impl Drop for Deferrer | |
| { | |
| fn finalize(&self) | |
| { | |
| (self.df)(); |
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
| extern mod crate; | |
| fn main() | |
| { | |
| println(fmt!("%?", crate::rand())); | |
| } |
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 core::libc::c_int; | |
| pub extern "C" | |
| { | |
| fn c_func(atexit_ptr : extern "C" fn(cb : extern "C" fn()) -> c_int) -> bool; | |
| fn atexit(cb : extern "C" fn()) -> c_int; | |
| } | |
| fn main() | |
| { |
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 c_struct; | |
| unsafe fn c_function(a : *mut c_struct) | |
| { | |
| } | |
| struct wrapper | |
| { | |
| payload : *c_struct |
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 core::libc::*; | |
| extern "C" | |
| { | |
| fn c_func(cb : extern "C" fn(data : *mut c_void), data : *mut c_void); | |
| } | |
| fn rust_func<T>(cb : &fn(data : &T), data : &T) | |
| { | |
| unsafe |
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; | |
| struct Manager<'self> | |
| { | |
| Resources : ~[~Resource], | |
| Count : &'self mut i32 | |
| } | |
| struct Object<'self> | |
| { |
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 Owned | |
| { | |
| Name : ~str | |
| } | |
| struct Node | |
| { | |
| Resource : Owned, | |
| Children : ~[Node] | |
| } |
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 Node | |
| { | |
| Name : ~str, | |
| Children : ~[Node] | |
| } | |
| impl Drop for Node | |
| { | |
| fn finalize(&self) | |
| { |
OlderNewer