Enum i_slint_compiler::langtype::ElementType
source · pub enum ElementType {
Component(Rc<Component>),
Builtin(Rc<BuiltinElement>),
Native(Rc<NativeClass>),
Error,
Global,
}
Expand description
The base of an element
Variants§
Component(Rc<Component>)
The element is based of a component
Builtin(Rc<BuiltinElement>)
The element is a builtin element
Native(Rc<NativeClass>)
The native type was resolved by the resolve_native_class pass.
Error
The base element couldn’t be looked up
Global
This should be the base type of the root element of a global component
Implementations§
source§impl ElementType
impl ElementType
pub fn lookup_property<'a>(&self, name: &'a str) -> PropertyLookupResult<'a>
sourcepub fn property_list(&self) -> Vec<(String, Type)>
pub fn property_list(&self) -> Vec<(String, Type)>
List of sub properties valid for the auto completion
sourcepub fn accepts_child_element(
&self,
name: &str,
tr: &TypeRegister
) -> Result<Option<ElementType>, String>
pub fn accepts_child_element( &self, name: &str, tr: &TypeRegister ) -> Result<Option<ElementType>, String>
This function looks at the element and checks whether it can have Elements of type name
as children.
It returns an Error if that is not possible or an Option of the ElementType if it is.
The option is unset when the compiler does not know the type well enough to avoid further
probing.
sourcepub fn lookup_type_for_child_element(
&self,
name: &str,
tr: &TypeRegister
) -> Result<ElementType, String>
pub fn lookup_type_for_child_element( &self, name: &str, tr: &TypeRegister ) -> Result<ElementType, String>
This function looks at the element and checks whether it can have Elements of type name
as children.
In addition to what accepts_child_element
does, this method also probes the type of name
.
It returns an Error if that is not possible or an ElementType
if it is.
pub fn lookup_member_function(&self, name: &str) -> Option<BuiltinFunction>
pub fn collect_contextual_types( &self, context_restricted_types: &mut HashMap<String, HashSet<String>> )
sourcepub fn as_builtin(&self) -> &BuiltinElement
pub fn as_builtin(&self) -> &BuiltinElement
Assume this is a builtin type, panic if it isn’t
sourcepub fn as_native(&self) -> &NativeClass
pub fn as_native(&self) -> &NativeClass
Assume this is a builtin type, panic if it isn’t
sourcepub fn as_component(&self) -> &Rc<Component>
pub fn as_component(&self) -> &Rc<Component>
Assume it is a Component, panic if it isn’t
Trait Implementations§
source§impl Clone for ElementType
impl Clone for ElementType
source§fn clone(&self) -> ElementType
fn clone(&self) -> ElementType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more