diff options
Diffstat (limited to 'crates/base_db')
-rw-r--r-- | crates/base_db/src/input.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/base_db/src/input.rs b/crates/base_db/src/input.rs index a693e7f80..9567bcc42 100644 --- a/crates/base_db/src/input.rs +++ b/crates/base_db/src/input.rs | |||
@@ -151,8 +151,12 @@ pub enum ProcMacroKind { | |||
151 | } | 151 | } |
152 | 152 | ||
153 | pub trait ProcMacroExpander: fmt::Debug + Send + Sync + RefUnwindSafe { | 153 | pub trait ProcMacroExpander: fmt::Debug + Send + Sync + RefUnwindSafe { |
154 | fn expand(&self, subtree: &Subtree, attrs: Option<&Subtree>) | 154 | fn expand( |
155 | -> Result<Subtree, ExpansionError>; | 155 | &self, |
156 | subtree: &Subtree, | ||
157 | attrs: Option<&Subtree>, | ||
158 | env: &Env, | ||
159 | ) -> Result<Subtree, ExpansionError>; | ||
156 | } | 160 | } |
157 | 161 | ||
158 | #[derive(Debug, Clone)] | 162 | #[derive(Debug, Clone)] |
@@ -418,6 +422,10 @@ impl Env { | |||
418 | pub fn get(&self, env: &str) -> Option<String> { | 422 | pub fn get(&self, env: &str) -> Option<String> { |
419 | self.entries.get(env).cloned() | 423 | self.entries.get(env).cloned() |
420 | } | 424 | } |
425 | |||
426 | pub fn iter(&self) -> impl Iterator<Item = (&str, &str)> { | ||
427 | self.entries.iter().map(|(k, v)| (k.as_str(), v.as_str())) | ||
428 | } | ||
421 | } | 429 | } |
422 | 430 | ||
423 | #[derive(Debug)] | 431 | #[derive(Debug)] |