pub enum Type {
Show 28 variants Invalid, Void, InferredProperty, InferredCallback, Callback { return_type: Option<Box<Type>>, args: Vec<Type>, }, Function { return_type: Box<Type>, args: Vec<Type>, }, Float32, Int32, String, Color, Duration, PhysicalLength, LogicalLength, Rem, 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

§

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

§

Rem

§

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§

source§

impl Type

source

pub fn is_property_type(&self) -> bool

valid type for properties

source

pub fn ok_for_public_api(&self) -> bool

source

pub fn as_enum(&self) -> &Rc<Enumeration>

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

source

pub fn can_convert(&self, other: &Self) -> bool

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

source

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

source

pub fn as_unit_product(&self) -> Option<Vec<(Unit, i8)>>

Return a unit product vector even for single scalar

Trait Implementations§

source§

impl Clone for Type

source§

fn clone(&self) -> Type

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Type

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Type

source§

fn default() -> Type

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

impl Display for Type

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Type> for PropertyDeclaration

source§

fn from(ty: Type) -> Self

Converts to this type from the input type.
source§

impl PartialEq<Type> for Type

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.