Created
April 14, 2014 10:44
-
-
Save Meyermagic/10636908 to your computer and use it in GitHub Desktop.
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
extern crate othercrate = "othercrate#0.1.0"; | |
use std::intrinsics::TypeId; | |
use othercrate::other::{Foo, foo_id}; | |
fn main() { | |
println!("Foo's TypeId from this crate: {}", TypeId::of::<Foo>()); | |
println!("Foo's TypeId from othercrate: {}", foo_id()); | |
} |
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
.PHONY : all | |
all: thiscrate | |
.PHONY : thiscrate | |
thiscrate: libothercrate | |
rustc -L . -O main.rs | |
.PHONY : libothercrate | |
libothercrate: | |
rustc -O --crate-type=rlib --out-dir . othercrate/lib.rs |
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
#![crate_id = "othercrate#0.1.0"] | |
#![crate_type = "lib"] | |
pub mod other; |
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::intrinsics::TypeId; | |
pub enum Foo { | |
VarA(uint), | |
VarB(uint, uint) | |
} | |
pub fn foo_id() -> TypeId { | |
TypeId::of::<Foo>() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prints
Foo's TypeId from this crate: TypeId { t: 17870372292551777611 }
Foo's TypeId from othercrate: TypeId { t: 15921533803692407670 }