SubComponent

Struct SubComponent 

Source
pub struct SubComponent {
Show 22 fields pub name: SmolStr, pub properties: TiVec<PropertyIdx, Property>, pub functions: TiVec<FunctionIdx, Function>, pub items: TiVec<ItemInstanceIdx, Item>, pub repeated: TiVec<RepeatedElementIdx, RepeatedElement>, pub component_containers: Vec<ComponentContainerElement>, pub popup_windows: Vec<PopupWindow>, pub menu_item_trees: Vec<ItemTree>, pub timers: Vec<Timer>, pub sub_components: TiVec<SubComponentInstanceIdx, SubComponentInstance>, pub property_init: Vec<(PropertyReference, BindingExpression)>, pub change_callbacks: Vec<(PropertyReference, MutExpression)>, pub animations: HashMap<PropertyReference, Expression>, pub two_way_bindings: Vec<(PropertyReference, PropertyReference)>, pub const_properties: Vec<PropertyReference>, pub init_code: Vec<MutExpression>, pub geometries: Vec<Option<MutExpression>>, pub layout_info_h: MutExpression, pub layout_info_v: MutExpression, pub accessible_prop: BTreeMap<(u32, String), MutExpression>, pub element_infos: BTreeMap<u32, String>, pub prop_analysis: HashMap<PropertyReference, PropAnalysis>,
}

Fields§

§name: SmolStr§properties: TiVec<PropertyIdx, Property>§functions: TiVec<FunctionIdx, Function>§items: TiVec<ItemInstanceIdx, Item>§repeated: TiVec<RepeatedElementIdx, RepeatedElement>§component_containers: Vec<ComponentContainerElement>§popup_windows: Vec<PopupWindow>§menu_item_trees: Vec<ItemTree>

The MenuItem trees. The index is stored in a Expression::NumberLiteral in the arguments of BuiltinFunction::ShowPopupMenu and BuiltinFunction::SetupNativeMenuBar

§timers: Vec<Timer>§sub_components: TiVec<SubComponentInstanceIdx, SubComponentInstance>§property_init: Vec<(PropertyReference, BindingExpression)>

The initial value or binding for properties. This is ordered in the order they must be set.

§change_callbacks: Vec<(PropertyReference, MutExpression)>§animations: HashMap<PropertyReference, Expression>

The animation for properties which are animated

§two_way_bindings: Vec<(PropertyReference, PropertyReference)>§const_properties: Vec<PropertyReference>§init_code: Vec<MutExpression>

Code that is run in the sub component constructor, after property initializations

§geometries: Vec<Option<MutExpression>>

For each node, an expression that returns a {x: length, y: length, width: length, height: length}

§layout_info_h: MutExpression§layout_info_v: MutExpression§accessible_prop: BTreeMap<(u32, String), MutExpression>

Maps (item_index, property) to an expression

§element_infos: BTreeMap<u32, String>

Maps item index to a list of encoded element infos of the element (type name, qualified ids).

§prop_analysis: HashMap<PropertyReference, PropAnalysis>

Implementations§

Source§

impl SubComponent

Source

pub fn repeater_count(&self, cu: &CompilationUnit) -> u32

total count of repeater, including in sub components

Source

pub fn child_item_count(&self, cu: &CompilationUnit) -> u32

total count of items, including in sub components

Source

pub fn prop_used(&self, prop: &PropertyReference, cu: &CompilationUnit) -> bool

Return if a local property is used. (unused property shouldn’t be generated)

Trait Implementations§

Source§

impl Debug for SubComponent

Source§

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

Formats the value using the given formatter. 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>,

Source§

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>,

Source§

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,