fix: release eq
This commit is contained in:
@@ -2,7 +2,6 @@ use core::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
|
||||
use derive_more::Constructor;
|
||||
use ecow::EcoString;
|
||||
use hashbrown::{HashMap, HashSet};
|
||||
use itertools::Itertools;
|
||||
|
||||
@@ -16,17 +15,17 @@ use super::Value;
|
||||
#[repr(transparent)]
|
||||
#[derive(Constructor, Clone, PartialEq, Debug)]
|
||||
pub struct AttrSet {
|
||||
data: HashMap<EcoString, Value>,
|
||||
data: HashMap<String, Value>,
|
||||
}
|
||||
|
||||
impl From<HashMap<EcoString, Value>> for AttrSet {
|
||||
fn from(data: HashMap<EcoString, Value>) -> Self {
|
||||
impl From<HashMap<String, Value>> for AttrSet {
|
||||
fn from(data: HashMap<String, Value>) -> Self {
|
||||
Self { data }
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for AttrSet {
|
||||
type Target = HashMap<EcoString, Value>;
|
||||
type Target = HashMap<String, Value>;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.data
|
||||
}
|
||||
@@ -39,11 +38,11 @@ impl AttrSet {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn push_attr_force(&mut self, sym: EcoString, val: Value) {
|
||||
pub fn push_attr_force(&mut self, sym: String, val: Value) {
|
||||
self.data.insert(sym, val);
|
||||
}
|
||||
|
||||
pub fn push_attr(&mut self, sym: EcoString, val: Value) {
|
||||
pub fn push_attr(&mut self, sym: String, val: Value) {
|
||||
if self.data.get(&sym).is_some() {
|
||||
todo!()
|
||||
}
|
||||
@@ -52,7 +51,7 @@ impl AttrSet {
|
||||
|
||||
pub fn select(
|
||||
&self,
|
||||
mut path: impl DoubleEndedIterator<Item = Result<EcoString>>,
|
||||
mut path: impl DoubleEndedIterator<Item = Result<String>>,
|
||||
) -> Result<Value> {
|
||||
// .ok_or_else(|| Error::EvalError())),
|
||||
let mut data = &self.data;
|
||||
@@ -75,7 +74,7 @@ impl AttrSet {
|
||||
|
||||
pub fn has_attr(
|
||||
&self,
|
||||
mut path: impl DoubleEndedIterator<Item = Result<EcoString>>,
|
||||
mut path: impl DoubleEndedIterator<Item = Result<String>>,
|
||||
) -> Result<bool> {
|
||||
let mut data = &self.data;
|
||||
let last = path.nth_back(0).unwrap();
|
||||
@@ -94,15 +93,15 @@ impl AttrSet {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_inner(&self) -> &HashMap<EcoString, Value> {
|
||||
pub fn as_inner(&self) -> &HashMap<String, Value> {
|
||||
&self.data
|
||||
}
|
||||
|
||||
pub fn into_inner(self: Rc<Self>) -> Rc<HashMap<EcoString, Value>> {
|
||||
pub fn into_inner(self: Rc<Self>) -> Rc<HashMap<String, Value>> {
|
||||
unsafe { core::mem::transmute(self) }
|
||||
}
|
||||
|
||||
pub fn from_inner(data: HashMap<EcoString, Value>) -> Self {
|
||||
pub fn from_inner(data: HashMap<String, Value>) -> Self {
|
||||
Self { data }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user