mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 14:51:15 +00:00
Use SharedVector
for Value::Array
instead of Vec
That will make it more efficient to pass data into the interpreter in the future, especially from C++.
This commit is contained in:
parent
fdeca052cb
commit
41f77b2a27
3 changed files with 4 additions and 4 deletions
|
@ -11,7 +11,7 @@ use core::cell::RefCell;
|
|||
use neon::prelude::*;
|
||||
use rand::RngCore;
|
||||
use sixtyfps_compilerlib::langtype::Type;
|
||||
use sixtyfps_corelib::ImageReference;
|
||||
use sixtyfps_corelib::{ImageReference, SharedVector};
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
|
@ -198,7 +198,7 @@ fn to_eval_value<'cx>(
|
|||
Ok(Value::Array(
|
||||
vec.into_iter()
|
||||
.map(|i| to_eval_value(i, (*a).clone(), cx, persistent_context))
|
||||
.collect::<Result<Vec<_>, _>>()?,
|
||||
.collect::<Result<SharedVector<_>, _>>()?,
|
||||
))
|
||||
}
|
||||
Err(_) => {
|
||||
|
|
|
@ -117,7 +117,7 @@ pub enum Value {
|
|||
/// Correspond to the `image` type in .60
|
||||
Image(ImageReference),
|
||||
/// An Array in the .60 language.
|
||||
Array(Vec<Value>),
|
||||
Array(SharedVector<Value>),
|
||||
/// A more complex model which is not created by the interpreter itself (Value::Array can also be used for model)
|
||||
Model(ModelPtr),
|
||||
/// An object
|
||||
|
|
|
@ -63,7 +63,7 @@ impl Model for ValueModel {
|
|||
fn set_row_data(&self, row: usize, data: Self::Data) {
|
||||
match &mut *self.value.borrow_mut() {
|
||||
Value::Array(a) => {
|
||||
a[row] = data;
|
||||
a.as_slice_mut()[row] = data;
|
||||
self.notify.row_changed(row)
|
||||
}
|
||||
Value::Model(model_ptr) => model_ptr.set_row_data(row, data),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue