mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 22:54:36 +00:00
Small typo fix :-)
This commit is contained in:
parent
bcaaa126da
commit
c18861125d
5 changed files with 7 additions and 7 deletions
|
@ -556,7 +556,7 @@ pub fn vtable(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||||
});
|
});
|
||||||
|
|
||||||
let static_vtable_macro_doc = format!(
|
let static_vtable_macro_doc = format!(
|
||||||
r"Instentiate a static {vtable} for a given type and implements `vtable::HasStaticVTable<{vtable}>` for it.
|
r"Instantiate a static {vtable} for a given type and implements `vtable::HasStaticVTable<{vtable}>` for it.
|
||||||
|
|
||||||
```ignore
|
```ignore
|
||||||
// The preview above is misleading because of rust-lang/rust#45939, so it is reproctuced bellow
|
// The preview above is misleading because of rust-lang/rust#45939, so it is reproctuced bellow
|
||||||
|
|
|
@ -41,7 +41,7 @@ impl Animal for Dog {
|
||||||
// the vtable macro also exposed a macro to create a vtable
|
// the vtable macro also exposed a macro to create a vtable
|
||||||
AnimalVTable_static!(static DOG_VT for Dog);
|
AnimalVTable_static!(static DOG_VT for Dog);
|
||||||
|
|
||||||
// with that, it is possible to instentiate a VBox
|
// with that, it is possible to instantiate a VBox
|
||||||
let animal_box = VBox::<AnimalVTable>::new(Dog(42));
|
let animal_box = VBox::<AnimalVTable>::new(Dog(42));
|
||||||
assert_eq!(animal_box.make_noise(2), 42 * 2);
|
assert_eq!(animal_box.make_noise(2), 42 * 2);
|
||||||
```
|
```
|
||||||
|
|
|
@ -94,7 +94,7 @@ pub enum ItemTreeNode<T> {
|
||||||
children_index: u32,
|
children_index: u32,
|
||||||
},
|
},
|
||||||
/// A placeholder for many instance of item in their own component which
|
/// A placeholder for many instance of item in their own component which
|
||||||
/// are instentiated according to a model.
|
/// are instantiated according to a model.
|
||||||
DynamicTree {
|
DynamicTree {
|
||||||
/// the undex which is passed in the visit_dynamic callback.
|
/// the undex which is passed in the visit_dynamic callback.
|
||||||
index: usize,
|
index: usize,
|
||||||
|
|
|
@ -295,7 +295,7 @@ fn generate_component(
|
||||||
Rc::new(t)
|
Rc::new(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn instentiate(
|
pub fn instantiate(
|
||||||
component_type: Rc<ComponentDescription>,
|
component_type: Rc<ComponentDescription>,
|
||||||
parent_ctx: Option<&EvaluationContext>,
|
parent_ctx: Option<&EvaluationContext>,
|
||||||
) -> ComponentBox {
|
) -> ComponentBox {
|
||||||
|
@ -379,7 +379,7 @@ pub fn instentiate(
|
||||||
match eval::eval_expression(&rep_in_comp.model, &*component_type, &eval_context) {
|
match eval::eval_expression(&rep_in_comp.model, &*component_type, &eval_context) {
|
||||||
crate::Value::Number(count) => {
|
crate::Value::Number(count) => {
|
||||||
vec.resize_with(count.round() as usize, || {
|
vec.resize_with(count.round() as usize, || {
|
||||||
instentiate(rep_in_comp.component_to_repeat.clone(), Some(&eval_context))
|
instantiate(rep_in_comp.component_to_repeat.clone(), Some(&eval_context))
|
||||||
});
|
});
|
||||||
for (i, x) in vec.iter().enumerate() {
|
for (i, x) in vec.iter().enumerate() {
|
||||||
rep_in_comp
|
rep_in_comp
|
||||||
|
@ -394,7 +394,7 @@ pub fn instentiate(
|
||||||
}
|
}
|
||||||
crate::Value::Array(a) => {
|
crate::Value::Array(a) => {
|
||||||
vec.resize_with(a.len(), || {
|
vec.resize_with(a.len(), || {
|
||||||
instentiate(rep_in_comp.component_to_repeat.clone(), Some(&eval_context))
|
instantiate(rep_in_comp.component_to_repeat.clone(), Some(&eval_context))
|
||||||
});
|
});
|
||||||
for (i, (x, val)) in vec.iter().zip(a.into_iter()).enumerate() {
|
for (i, (x, val)) in vec.iter().zip(a.into_iter()).enumerate() {
|
||||||
rep_in_comp
|
rep_in_comp
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl ComponentDescription {
|
||||||
|
|
||||||
/// Instantiate a runtime component from this ComponentDescription
|
/// Instantiate a runtime component from this ComponentDescription
|
||||||
pub fn create(self: Rc<Self>) -> ComponentBox {
|
pub fn create(self: Rc<Self>) -> ComponentBox {
|
||||||
dynamic_component::instentiate(self, None)
|
dynamic_component::instantiate(self, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set a value to property.
|
/// Set a value to property.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue