Enum i_slint_compiler::langtype::Type
source · [−]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 .slint 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 .slint, 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
sourceimpl 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)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn property_list(&self) -> Vec<(String, Type)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
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
sourceimpl From<Type> for PropertyDeclaration
impl From<Type> for PropertyDeclaration
Auto Trait Implementations
impl !RefUnwindSafe for Type
impl !Send for Type
impl !Sync for Type
impl Unpin for Type
impl !UnwindSafe for Type
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
sourcefn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian()
.
sourcefn read_from_big_endian(read: &mut R) -> Result<Self, Error>
fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian()
.
sourcefn read_from_native_endian(read: &mut R) -> Result<Self, Error>
fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian()
.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more