8d14573d36c82afca15ef7d8d04450cb2858c0de introduces Object::is_mutable().
This can be used to implement keys of dict as RefValue as well, instead of just String.
//! Test stub for a Dict type that uses RefValue as key
/// This shall become standard in combination with the is_mutable() flag
use super::{BoxedObject, Object, RefValue};
use indexmap::IndexMap;
// Alias for the inner dict
type InnerDict = IndexMap<RefValue, RefValue>;
// Dict object type
#[derive(Debug, Clone, PartialEq)]
pub struct Dict {
dict: InnerDict,
}
Things to do:
[ ] allow for creating dict with is_mutable() == false RefValues as keys
[ ] try to implement an indexing method using str still, so existing code especially in ast.rs doesn't need to be touched
8d14573d36c82afca15ef7d8d04450cb2858c0de introduces Object::is_mutable(). This can be used to implement keys of
dict
as RefValue as well, instead of justString
.src/value/dict2.rs was already a test-facility on this:
Things to do:
dict
with is_mutable() == false RefValues as keys