Adjust module organization to facilitate resurrection of the playground.
The playground doesn't / cannot depend on aiken-project because that becomes a gigantic pain. So instead, we try to keep essential stuff inside aiken-lang when possible.
This commit is contained in:
21
crates/aiken-lang/src/utils/indexmap.rs
Normal file
21
crates/aiken-lang/src/utils/indexmap.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use indexmap::IndexMap;
|
||||
use std::{collections::HashMap, hash::Hash};
|
||||
|
||||
pub fn as_ref_values<'a, K, V>(iter: &'a IndexMap<K, V>) -> IndexMap<&'a K, &'a V>
|
||||
where
|
||||
K: Eq + Hash + Clone + 'a,
|
||||
{
|
||||
let mut refs = IndexMap::new();
|
||||
for (k, v) in iter {
|
||||
refs.insert(k, v);
|
||||
}
|
||||
refs
|
||||
}
|
||||
|
||||
pub fn as_str_ref_values<V>(iter: &'_ HashMap<String, V>) -> IndexMap<&'_ str, &'_ V> {
|
||||
let mut refs = IndexMap::new();
|
||||
for (k, v) in iter {
|
||||
refs.insert(k.as_str(), v);
|
||||
}
|
||||
refs
|
||||
}
|
||||
1
crates/aiken-lang/src/utils/mod.rs
Normal file
1
crates/aiken-lang/src/utils/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod indexmap;
|
||||
0
crates/aiken-lang/src/utils/version.rs
Normal file
0
crates/aiken-lang/src/utils/version.rs
Normal file
Reference in New Issue
Block a user