From 45be53fa25f058335c19ec96c9946059b19fd90b Mon Sep 17 00:00:00 2001 From: Alix Bott Date: Thu, 21 Nov 2024 17:26:49 +0100 Subject: [PATCH] add Context::get_mut --- src/context.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/context.rs b/src/context.rs index 5a874ca4..cd424b52 100644 --- a/src/context.rs +++ b/src/context.rs @@ -118,6 +118,11 @@ impl Context { self.data.get(index) } + /// Returns a mutable reference to the value at a given key index. + pub fn get_mut(&mut self, index: &str) -> Option<&mut Value> { + self.data.get_mut(index) + } + /// Remove a key from the context, returning the value at the key if the key was previously inserted into the context. pub fn remove(&mut self, index: &str) -> Option { self.data.remove(index)