pub enum Type {
Show 30 variants
Invalid,
Void,
InferredProperty,
InferredCallback,
Component(Rc<Component>),
Builtin(Rc<BuiltinElement>),
Native(Rc<NativeClass>),
Callback {
return_type: Option<Box<Type>>,
args: Vec<Type>,
},
Function {
return_type: Box<Type>,
args: Vec<Type>,
},
Float32,
Int32,
String,
Color,
Duration,
PhysicalLength,
LogicalLength,
Angle,
Percent,
Image,
Bool,
Model,
PathData,
Easing,
Brush,
Array(Box<Type>),
Struct {
fields: BTreeMap<String, Type>,
name: Option<String>,
node: Option<ObjectType>,
},
Enumeration(Rc<Enumeration>),
UnitProduct(Vec<(Unit, i8)>),
ElementReference,
LayoutCache,
}
Variants§
Invalid
Correspond to an uninitialized type, or an error
Void
The type of an expression that return nothing
InferredProperty
The type of a property two way binding whose type was not yet inferred
InferredCallback
The type of a callback alias whose type was not yet inferred
Component(Rc<Component>)
Builtin(Rc<BuiltinElement>)
Native(Rc<NativeClass>)
Callback
Function
Float32
Int32
String
Color
Duration
PhysicalLength
LogicalLength
Angle
Percent
Image
Bool
Model
PathData
Easing
Brush
Array(Box<Type>)
This is usually a model
Struct
Fields
name: Option<String>
When declared in .60 as struct Foo := { }
, then the name is “Foo”
When there is no node, but there is a name, then it is a builtin type
node: Option<ObjectType>
When declared in .60, this is the node of the declaration.
Enumeration(Rc<Enumeration>)
UnitProduct(Vec<(Unit, i8)>)
A type made up of the product of several “unit” types. The first parameter is the unit, and the second parameter is the power. The vector should be sorted by 1) the power, 2) the unit.
ElementReference
LayoutCache
This is a SharedArray<f32>
Implementations§
Source§impl Type
impl Type
Sourcepub fn is_property_type(&self) -> bool
pub fn is_property_type(&self) -> bool
valid type for properties
pub fn ok_for_public_api(&self) -> bool
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
pub fn lookup_type_for_child_element( &self, name: &str, tr: &TypeRegister, ) -> Result<Type, String>
pub fn lookup_member_function(&self, name: &str) -> Expression
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
Sourcepub fn as_enum(&self) -> &Rc<Enumeration>
pub fn as_enum(&self) -> &Rc<Enumeration>
Assume it is an enumeration, panic if it isn’t
Sourcepub fn can_convert(&self, other: &Self) -> bool
pub fn can_convert(&self, other: &Self) -> bool
Return true if the type can be converted to the other type
pub fn collect_contextual_types( &self, context_restricted_types: &mut HashMap<String, HashSet<String>>, )
Sourcepub fn default_unit(&self) -> Option<Unit>
pub fn default_unit(&self) -> Option<Unit>
If this is a number type which should be used with an unit, this returns the default unit otherwise, returns None
Trait Implementations§
Source§impl From<Type> for PropertyDeclaration
impl From<Type> for PropertyDeclaration
Auto Trait Implementations§
impl Freeze for Type
impl !RefUnwindSafe for Type
impl !Send for Type
impl !Sync for Type
impl Unpin for Type
impl !UnwindSafe for Type
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
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>
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>
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