change function name for less confusion

main
Ziyang Hu 2 years ago
parent cc60909a70
commit 54c9327941

@ -318,7 +318,7 @@ impl RocksStorage {
let name = vs.next().unwrap().get_string().unwrap().to_string(); let name = vs.next().unwrap().get_string().unwrap().to_string();
let typ = vs.next().unwrap().get_string().unwrap(); let typ = vs.next().unwrap().get_string().unwrap();
let typ = env.build_type_from_str(&typ).unwrap(); let typ = env.build_type_from_str(&typ).unwrap();
let default = vs.next().unwrap().to_owned(); let default = vs.next().unwrap().owned_clone();
Col { Col {
name, name,
typ, typ,
@ -332,7 +332,7 @@ impl RocksStorage {
let name = vs.next().unwrap().get_string().unwrap().to_string(); let name = vs.next().unwrap().get_string().unwrap().to_string();
let typ = vs.next().unwrap().get_string().unwrap(); let typ = vs.next().unwrap().get_string().unwrap();
let typ = env.build_type_from_str(&typ).unwrap(); let typ = env.build_type_from_str(&typ).unwrap();
let default = vs.next().unwrap().to_owned(); let default = vs.next().unwrap().owned_clone();
Col { Col {
name, name,
typ, typ,
@ -362,7 +362,7 @@ impl RocksStorage {
let name = vs.next().unwrap().get_string().unwrap().to_string(); let name = vs.next().unwrap().get_string().unwrap().to_string();
let typ = vs.next().unwrap().get_string().unwrap(); let typ = vs.next().unwrap().get_string().unwrap();
let typ = env.build_type_from_str(&typ).unwrap(); let typ = env.build_type_from_str(&typ).unwrap();
let default = vs.next().unwrap().to_owned(); let default = vs.next().unwrap().owned_clone();
Col { Col {
name, name,
typ, typ,
@ -376,7 +376,7 @@ impl RocksStorage {
let name = vs.next().unwrap().get_string().unwrap().to_string(); let name = vs.next().unwrap().get_string().unwrap().to_string();
let typ = vs.next().unwrap().get_string().unwrap(); let typ = vs.next().unwrap().get_string().unwrap();
let typ = env.build_type_from_str(&typ).unwrap(); let typ = env.build_type_from_str(&typ).unwrap();
let default = vs.next().unwrap().to_owned(); let default = vs.next().unwrap().owned_clone();
Col { Col {
name, name,
typ, typ,

@ -87,7 +87,7 @@ mod tests {
_ => unreachable!() _ => unreachable!()
}; };
eval.env.push(); eval.env.push();
eval.env.define("$data".to_string(), Structured::Value(bound_value.to_owned())); eval.env.define("$data".to_string(), Structured::Value(bound_value.owned_clone()));
eval.eval_mutation(insert_stmt.next().unwrap()).unwrap(); eval.eval_mutation(insert_stmt.next().unwrap()).unwrap();
// println!("{:#?}", evaluated); // println!("{:#?}", evaluated);
eval.env.pop(); eval.env.pop();

@ -506,7 +506,7 @@ pub fn cmp_data<'a>(pa: &mut ByteArrayParser<'a>, pb: &mut ByteArrayParser<'a>)
impl<'a> Value<'a> { impl<'a> Value<'a> {
pub fn to_owned(&self) -> Value<'static> { pub fn owned_clone(&self) -> Value<'static> {
use Value::*; use Value::*;
match self { match self {
@ -522,7 +522,7 @@ impl<'a> Value<'a> {
let mut inner = Vec::with_capacity(l.len()); let mut inner = Vec::with_capacity(l.len());
for el in l.iter() { for el in l.iter() {
inner.push(el.clone().to_owned()) inner.push(el.owned_clone())
} }
List(Rc::new(inner)) List(Rc::new(inner))
} }
@ -530,7 +530,7 @@ impl<'a> Value<'a> {
let mut inner = BTreeMap::new(); let mut inner = BTreeMap::new();
for (k, v) in d.iter() { for (k, v) in d.iter() {
let new_k = Cow::from(k.clone().into_owned()); let new_k = Cow::from(k.clone().into_owned());
inner.insert(new_k, v.clone().to_owned()); inner.insert(new_k, v.owned_clone());
} }
Dict(Rc::new(inner)) Dict(Rc::new(inner))
} }

Loading…
Cancel
Save