summaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/lib.rs2
-rw-r--r--helix-core/src/macros.rs17
-rw-r--r--helix-core/src/state.rs2
3 files changed, 20 insertions, 1 deletions
diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs
index c617fdbf..e443168e 100644
--- a/helix-core/src/lib.rs
+++ b/helix-core/src/lib.rs
@@ -1,5 +1,7 @@
#![allow(unused)]
+pub mod config;
pub mod graphemes;
+pub mod macros;
mod position;
mod selection;
pub mod state;
diff --git a/helix-core/src/macros.rs b/helix-core/src/macros.rs
new file mode 100644
index 00000000..1321ea5f
--- /dev/null
+++ b/helix-core/src/macros.rs
@@ -0,0 +1,17 @@
+#[macro_export]
+macro_rules! hashmap {
+ (@single $($x:tt)*) => (());
+ (@count $($rest:expr),*) => (<[()]>::len(&[$(hashmap!(@single $rest)),*]));
+
+ ($($key:expr => $value:expr,)+) => { hashmap!($($key => $value),+) };
+ ($($key:expr => $value:expr),*) => {
+ {
+ let _cap = hashmap!(@count $($key),*);
+ let mut _map = ::std::collections::HashMap::with_capacity(_cap);
+ $(
+ let _ = _map.insert($key, $value);
+ )*
+ _map
+ }
+ };
+}
diff --git a/helix-core/src/state.rs b/helix-core/src/state.rs
index 5b5f06c0..79e15eff 100644
--- a/helix-core/src/state.rs
+++ b/helix-core/src/state.rs
@@ -4,7 +4,7 @@ use anyhow::Error;
use std::path::PathBuf;
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub enum Mode {
Normal,
Insert,