Created
April 19, 2014 01:31
-
-
Save fkaa/11070927 to your computer and use it in GitHub Desktop.
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 Asset { | |
| cache: HashMap<~str, Gc<~Any>> | |
| } | |
| impl Asset { | |
| pub fn load<T>(path: Path) -> IoResult<@T> { | |
| let fc = FileContent::from(path); //temp | |
| let ret = fc.unwrap(); | |
| Ok(unsafe { cast::transmute(@ret) }) | |
| } | |
| } | |
| fn main() { | |
| /*let foo: @int = Asset::load::<int>(Path::new("foo.txt")).unwrap(); | |
| println!("{}", foo);*/ | |
| let fc: @FileContent = Asset::load::<FileContent>(Path::new("foo.txt")).unwrap(); | |
| fc.foo(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment