Struct i_slint_compiler::object_tree::Element
source · [−]pub struct Element {Show 18 fields
pub id: String,
pub base_type: Type,
pub bindings: BindingsMap,
pub property_analysis: RefCell<HashMap<String, PropertyAnalysis>>,
pub children: Vec<ElementRc>,
pub enclosing_component: Weak<Component>,
pub property_declarations: BTreeMap<String, PropertyDeclaration>,
pub named_references: NamedReferenceContainer,
pub repeated: Option<RepeatedElementInfo>,
pub states: Vec<State>,
pub transitions: Vec<Transition>,
pub child_of_layout: bool,
pub layout_info_prop: Option<(NamedReference, NamedReference)>,
pub is_flickable_viewport: bool,
pub item_index: OnceCell<usize>,
pub item_index_of_first_children: OnceCell<usize>,
pub inline_depth: i32,
pub node: Option<Element>,
}
Expand description
An Element is an instantiation of a Component
Fields
id: String
The id as named in the original .slint file.
Note that it can only be used for lookup before inlining. After inlining there can be duplicated id in the component. The id are then re-assigned unique id in the assign_id pass
base_type: Type
bindings: BindingsMap
Currently contains also the callbacks. FIXME: should that be changed?
property_analysis: RefCell<HashMap<String, PropertyAnalysis>>
children: Vec<ElementRc>
enclosing_component: Weak<Component>
The component which contains this element.
property_declarations: BTreeMap<String, PropertyDeclaration>
named_references: NamedReferenceContainer
Main owner for a reference to a property.
repeated: Option<RepeatedElementInfo>
Tis element is part of a `for
states: Vec<State>
transitions: Vec<Transition>
child_of_layout: bool
true when this item’s geometry is handled by a layout
layout_info_prop: Option<(NamedReference, NamedReference)>
The property pointing to the layout info. (horizontal, vertical)
is_flickable_viewport: bool
true if this Element is the fake Flickable viewport
item_index: OnceCell<usize>
This is the component-local index of this item in the item tree array. It is generated after the last pass and before the generators run.
item_index_of_first_children: OnceCell<usize>
the index of the first children in the tree, set with item_index
inline_depth: i32
How many times the element was inlined
node: Option<Element>
The AST node, if available
Implementations
sourceimpl Element
impl Element
pub fn from_node(
node: Element,
id: String,
parent_type: Type,
component_child_insertion_point: &mut Option<(ElementRc, ChildrenPlaceholder)>,
diag: &mut BuildDiagnostics,
tr: &TypeRegister
) -> ElementRc
sourcepub fn lookup_property<'a>(&self, name: &'a str) -> PropertyLookupResult<'a>
pub fn lookup_property<'a>(&self, name: &'a str) -> PropertyLookupResult<'a>
Return the type of a property in this element or its base, along with the final name, in case the provided name points towards a property alias. Type::Invalid is returned if the property does not exist.
pub fn native_class(&self) -> Option<Rc<NativeClass>>
pub fn builtin_type(&self) -> Option<Rc<BuiltinElement>>
pub fn layout_info_prop(
&self,
orientation: Orientation
) -> Option<&NamedReference>
sourcepub fn original_name(&self) -> String
pub fn original_name(&self) -> String
Returns the element’s name as specified in the markup, not normalized.
sourcepub fn is_binding_set(
self: &Element,
property_name: &str,
need_explicit: bool
) -> bool
pub fn is_binding_set(
self: &Element,
property_name: &str,
need_explicit: bool
) -> bool
Return true if the binding is set, either on this element or in a base
If need_explicit
is true, then only consider binding set in the code, not the ones set
by the compiler later.
sourcepub fn set_binding_if_not_set(
&mut self,
property_name: String,
expression_fn: impl FnOnce() -> Expression
)
pub fn set_binding_if_not_set(
&mut self,
property_name: String,
expression_fn: impl FnOnce() -> Expression
)
Set the property property_name
of this Element only if it was not set.
the expression_fn
will only be called if it isn’t set
pub fn sub_component(&self) -> Option<&Rc<Component>>
Trait Implementations
sourceimpl Spanned for Element
impl Spanned for Element
fn span(&self) -> Span
fn source_file(&self) -> Option<&SourceFile>
fn to_source_location(&self) -> SourceLocation
Auto Trait Implementations
impl !RefUnwindSafe for Element
impl !Send for Element
impl !Sync for Element
impl Unpin for Element
impl !UnwindSafe for Element
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
sourcefn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian()
.
sourcefn read_from_big_endian(read: &mut R) -> Result<Self, Error>
fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian()
.
sourcefn read_from_native_endian(read: &mut R) -> Result<Self, Error>
fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian()
.