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<(SmolStr, Type)>
pub fn property_list(&self) -> Vec<(SmolStr, Type)>
List of sub properties valid for the auto completion
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.
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
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ElementType
impl Debug for ElementType
Source§impl Default for ElementType
impl Default for ElementType
Source§impl Display for ElementType
impl Display for ElementType
Source§impl From<Rc<BuiltinElement>> for ElementType
impl From<Rc<BuiltinElement>> for ElementType
Source§fn from(value: Rc<BuiltinElement>) -> Self
fn from(value: Rc<BuiltinElement>) -> Self
Converts to this type from the input type.
Source§impl From<Rc<NativeClass>> for ElementType
impl From<Rc<NativeClass>> for ElementType
Source§fn from(value: Rc<NativeClass>) -> Self
fn from(value: Rc<NativeClass>) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ElementType
impl PartialEq for ElementType
Auto Trait Implementations§
impl Freeze for ElementType
impl !RefUnwindSafe for ElementType
impl !Send for ElementType
impl !Sync for ElementType
impl Unpin for ElementType
impl !UnwindSafe for ElementType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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