aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_tt
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-11-03 05:19:50 +0000
committerEdwin Cheng <[email protected]>2019-11-04 17:38:20 +0000
commit9fd546bec23ac817a45da28889e76118969db91e (patch)
treed00a96f165b9d986fb7ebb37c8ec5733082fcb47 /crates/ra_tt
parentd9fb01f803671bfb6fca6b873bd140d8177ecb1c (diff)
Add map_id to TokenId
Diffstat (limited to 'crates/ra_tt')
-rw-r--r--crates/ra_tt/src/lib.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/crates/ra_tt/src/lib.rs b/crates/ra_tt/src/lib.rs
index 20c251ff4..96410ff22 100644
--- a/crates/ra_tt/src/lib.rs
+++ b/crates/ra_tt/src/lib.rs
@@ -25,11 +25,23 @@ use smol_str::SmolStr;
25/// source token and making sure that identities are preserved during macro 25/// source token and making sure that identities are preserved during macro
26/// expansion. 26/// expansion.
27#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 27#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
28pub struct TokenId(pub u32); 28pub struct TokenId(u32, u32);
29 29
30impl TokenId { 30impl TokenId {
31 pub fn new(token_id: u32, map_id: u32) -> TokenId {
32 TokenId(token_id, map_id)
33 }
34
31 pub const fn unspecified() -> TokenId { 35 pub const fn unspecified() -> TokenId {
32 TokenId(!0) 36 TokenId(!0, !0)
37 }
38
39 pub fn token_id(&self) -> u32 {
40 self.0
41 }
42
43 pub fn map_id(&self) -> u32 {
44 self.1
33 } 45 }
34} 46}
35 47