logo
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

Fields

return_type: Option<Box<Type>>
args: Vec<Type>

Function

Fields

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

This is usually a model

Struct

Fields

fields: BTreeMap<String, Type>
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

valid type for properties

List of sub properties valid for the auto completion

Assume this is a builtin type, panic if it isn’t

Assume this is a builtin type, panic if it isn’t

Assume it is a Component, panic if it isn’t

Assume it is an enumeration, panic if it isn’t

Return true if the type can be converted to the other type

If this is a number type which should be used with an unit, this returns the default unit otherwise, returns None

Return a unit product vector even for single scalar

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.