From dd062e63f1ae7b277d6684f431532104969db5bf Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 17 Jun 2024 17:39:44 -0400 Subject: [PATCH] Change context storage from BTreeMap to HashMap --- dust-lang/src/context.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dust-lang/src/context.rs b/dust-lang/src/context.rs index c829a65..38aa9ab 100644 --- a/dust-lang/src/context.rs +++ b/dust-lang/src/context.rs @@ -1,5 +1,5 @@ use std::{ - collections::BTreeMap, + collections::HashMap, sync::{Arc, RwLock, RwLockReadGuard}, }; @@ -12,7 +12,7 @@ use crate::{ #[derive(Clone, Debug)] pub struct Context<'a> { - variables: Arc>>, + variables: Arc>>, parent: Option<&'a Context<'a>>, is_clean: Arc>, } @@ -20,7 +20,7 @@ pub struct Context<'a> { impl<'a> Context<'a> { pub fn new(parent: Option<&'a Context>) -> Self { Self { - variables: Arc::new(RwLock::new(BTreeMap::new())), + variables: Arc::new(RwLock::new(HashMap::new())), parent, is_clean: Arc::new(RwLock::new(true)), } @@ -32,7 +32,7 @@ impl<'a> Context<'a> { pub fn inner( &self, - ) -> Result>, RwLockPoisonError> + ) -> Result>, RwLockPoisonError> { Ok(self.variables.read()?) }