diff --git a/src/protocol/eval/value.rs b/src/protocol/eval/value.rs index d8bf773b7bc74426a37fa54ad573c4c0d6d8bd00..c4c5060485d669df5943ff6af48090d89b0f604e 100644 --- a/src/protocol/eval/value.rs +++ b/src/protocol/eval/value.rs @@ -183,6 +183,7 @@ impl ValueGroup { regions: Vec::new(), } } + pub(crate) fn from_store(store: &Store, values: &[Value]) -> Self { let mut group = ValueGroup{ values: Vec::with_capacity(values.len()), @@ -197,6 +198,15 @@ impl ValueGroup { group } + /// Creates a clone of the value group, but leaves the memory inside of the + /// ValueGroup vectors allocated. + pub(crate) fn take(&mut self) -> ValueGroup { + let cloned = self.clone(); + self.values.clear(); + self.regions.clear(); + return cloned; + } + /// Transfers a provided value from a store into a local value with its /// heap allocations (if any) stored in the ValueGroup. Calling this /// function will not store the returned value in the `values` member.