Struct i_slint_compiler::object_tree::Component

source ·
pub struct Component {
Show 15 fields pub node: Option<SyntaxNode>, pub id: String, pub root_element: ElementRc, pub parent_element: Weak<RefCell<Element>>, pub optimized_elements: RefCell<Vec<ElementRc>>, pub embedded_file_resources: RefCell<HashMap<String, EmbeddedResources>>, pub root_constraints: RefCell<LayoutConstraints>, pub child_insertion_point: RefCell<Option<(ElementRc, usize, ChildrenPlaceholder)>>, pub init_code: RefCell<InitCode>, pub used_types: RefCell<UsedSubTypes>, pub popup_windows: RefCell<Vec<PopupWindow>>, pub inherits_popup_window: Cell<bool>, pub exported_global_names: RefCell<Vec<ExportedName>>, pub private_properties: RefCell<Vec<(String, Type)>>, pub is_root_component: Cell<bool>,
}
Expand description

A component is a type in the language which can be instantiated, Or is materialized for repeated expression.

Fields§

§node: Option<SyntaxNode>§id: String§root_element: ElementRc§parent_element: Weak<RefCell<Element>>

The parent element within the parent component if this component represents a repeated element

§optimized_elements: RefCell<Vec<ElementRc>>

List of elements that are not attached to the root anymore because they have been optimized away, but their properties may still be in use

§embedded_file_resources: RefCell<HashMap<String, EmbeddedResources>>

Map of resources that should be embedded in the generated code, indexed by their absolute path on disk on the build system

§root_constraints: RefCell<LayoutConstraints>

The layout constraints of the root item

§child_insertion_point: RefCell<Option<(ElementRc, usize, ChildrenPlaceholder)>>

When creating this component and inserting “children”, append them to the children of the element pointer to by this field.

§init_code: RefCell<InitCode>§used_types: RefCell<UsedSubTypes>

The list of used extra types used (recursively) by this root component. (This only make sense on the root component)

§popup_windows: RefCell<Vec<PopupWindow>>§inherits_popup_window: Cell<bool>

This component actually inherits PopupWindow (although that has been changed to a Window by the lower_popups pass)

§exported_global_names: RefCell<Vec<ExportedName>>

The names under which this component should be accessible if it is a global singleton and exported.

§private_properties: RefCell<Vec<(String, Type)>>

The list of properties (name and type) declared as private in the component. This is used to issue better error in the generated code if the property is used.

§is_root_component: Cell<bool>

This is the main entry point for the code generators. Such a component should have the full API, etc.

Implementations§

source§

impl Component

source

pub fn from_node( node: Component, diag: &mut BuildDiagnostics, tr: &TypeRegister ) -> Rc<Self>

source

pub fn is_global(&self) -> bool

This component is a global component introduced with the “global” keyword

source

pub fn visible_in_public_api(&self) -> bool

source

pub fn global_aliases(&self) -> Vec<String>

Returns the names of aliases to global singletons, exactly as specified in the .slint markup (not normalized).

source

pub fn is_sub_component(&self) -> bool

source

pub fn repeater_count(&self) -> u32

Trait Implementations§

source§

impl Debug for Component

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Component

source§

fn default() -> Component

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.