From ef8aa763faa59fd62c90c6d6245e8d2c5eece35e Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sun, 4 Oct 2020 20:22:11 +0200 Subject: =?UTF-8?q?Shorten=20some=20names=20=E2=86=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/eval/scope.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/eval/scope.rs') diff --git a/src/eval/scope.rs b/src/eval/scope.rs index 7d69e1fc..fc530bbb 100644 --- a/src/eval/scope.rs +++ b/src/eval/scope.rs @@ -18,15 +18,15 @@ impl Scope { Self { functions: HashMap::new() } } - /// Associate the given name with the function. - pub fn insert(&mut self, name: impl Into, function: ValueFunc) { - self.functions.insert(name.into(), function); - } - /// Return the function with the given name if there is one. - pub fn func(&self, name: &str) -> Option<&ValueFunc> { + pub fn get(&self, name: &str) -> Option<&ValueFunc> { self.functions.get(name) } + + /// Associate the given name with the function. + pub fn set(&mut self, name: impl Into, function: ValueFunc) { + self.functions.insert(name.into(), function); + } } impl Debug for Scope { -- cgit v1.2.3