diff --git a/src/scripting/bind.rs b/src/scripting/bind.rs index 9486b2f..06eb9a5 100644 --- a/src/scripting/bind.rs +++ b/src/scripting/bind.rs @@ -73,29 +73,29 @@ fn to_scylla_value(v: &Value, typ: &ColumnType) -> Result { }, (Value::Vec(v), ColumnType::List(elt)) => { let v = v.borrow_ref().unwrap(); - let elements = v - .as_ref() - .iter() - .map(|v| to_scylla_value(v, elt)) - .try_collect()?; + let mut elements = Vec::with_capacity(v.len()); + for elem in v.iter() { + let elem = to_scylla_value(elem, elt)?; + elements.push(elem); + } Ok(CqlValue::List(elements)) } (Value::Vec(v), ColumnType::Vector(elt, _dim)) => { let v = v.borrow_ref().unwrap(); - let elements = v - .as_ref() - .iter() - .map(|v| to_scylla_value(v, elt)) - .try_collect()?; + let mut elements = Vec::with_capacity(v.len()); + for elem in v.iter() { + let elem = to_scylla_value(elem, elt)?; + elements.push(elem); + } Ok(CqlValue::Vector(elements)) } (Value::Vec(v), ColumnType::Set(elt)) => { let v = v.borrow_ref().unwrap(); - let elements = v - .as_ref() - .iter() - .map(|v| to_scylla_value(v, elt)) - .try_collect()?; + let mut elements = Vec::with_capacity(v.len()); + for elem in v.iter() { + let elem = to_scylla_value(elem, elt)?; + elements.push(elem); + } Ok(CqlValue::Set(elements)) } (Value::Vec(v), ColumnType::Map(key_elt, value_elt)) => {