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:
KtorZ
2024-08-29 09:11:26 +02:00
parent 8bccbd9e00
commit e31c6de04e
18 changed files with 1360 additions and 1342 deletions

View File

@@ -14,7 +14,10 @@ pub mod line_numbers;
pub mod parser;
pub mod plutus_version;
pub mod pretty;
pub mod test_framework;
pub mod tipo;
pub mod utils;
pub mod version;
#[derive(Debug, Default, Clone)]
pub struct IdGenerator {

File diff suppressed because it is too large Load Diff

View 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
}

View File

@@ -0,0 +1 @@
pub mod indexmap;

View File

View File

@@ -0,0 +1,15 @@
pub fn compiler_version(include_commit_hash: bool) -> String {
if include_commit_hash {
format!(
"v{}+{}",
built_info::PKG_VERSION,
built_info::GIT_COMMIT_HASH_SHORT.unwrap_or("unknown")
)
} else {
format!("v{}", built_info::PKG_VERSION,)
}
}
mod built_info {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
}