diff options
Diffstat (limited to 'crates/ra_db/src')
-rw-r--r-- | crates/ra_db/src/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/crates/ra_db/src/lib.rs b/crates/ra_db/src/lib.rs index 833f95eeb..c5587c950 100644 --- a/crates/ra_db/src/lib.rs +++ b/crates/ra_db/src/lib.rs | |||
@@ -38,6 +38,20 @@ pub use crate::{ | |||
38 | loc2id::{LocationIntener, NumericId}, | 38 | loc2id::{LocationIntener, NumericId}, |
39 | }; | 39 | }; |
40 | 40 | ||
41 | #[macro_export] | ||
42 | macro_rules! impl_numeric_id { | ||
43 | ($id:ident) => { | ||
44 | impl $crate::NumericId for $id { | ||
45 | fn from_u32(id: u32) -> Self { | ||
46 | $id(id) | ||
47 | } | ||
48 | fn to_u32(self) -> u32 { | ||
49 | self.0 | ||
50 | } | ||
51 | } | ||
52 | }; | ||
53 | } | ||
54 | |||
41 | pub trait BaseDatabase: salsa::Database { | 55 | pub trait BaseDatabase: salsa::Database { |
42 | fn check_canceled(&self) -> Cancelable<()> { | 56 | fn check_canceled(&self) -> Cancelable<()> { |
43 | if self.salsa_runtime().is_current_revision_canceled() { | 57 | if self.salsa_runtime().is_current_revision_canceled() { |