pub enum Type {
Show 16 variants
Int,
Num,
Bool,
Logical {
shape: Option<Vec<Option<usize>>>,
},
String,
Tensor {
shape: Option<Vec<Option<usize>>>,
},
Cell {
element_type: Option<Box<Type>>,
length: Option<usize>,
},
Function {
params: Vec<Type>,
returns: Box<Type>,
},
Void,
Unknown,
Union(Vec<Type>),
Struct {
known_fields: Option<Vec<String>>,
},
OutputList(Vec<Type>),
DataDataset {
arrays: Option<BTreeMap<String, DataArrayTypeInfo>>,
},
DataArray {
dtype: Option<String>,
shape: Option<Vec<Option<usize>>>,
chunk_shape: Option<Vec<Option<usize>>>,
codec: Option<String>,
},
DataTransaction,
}Expand description
Enhanced type system used throughout RunMat for HIR and builtin functions Designed to mirror Value variants for better type inference and LSP support
Variants§
Int
Integer number type
Num
Floating-point number type
Bool
Boolean type
Logical
Logical array type (N-D boolean array) with optional shape information
Fields
String
String type
Tensor
Tensor type with optional shape information (column-major semantics in runtime)
Fields
Cell
Cell array type with optional element type information
Fields
Function
Function type with parameter and return types
Void
Void type (no value)
Unknown
Unknown type (for type inference)
Union(Vec<Type>)
Union type (multiple possible types)
Struct
Struct-like type with optional known field set (purely for inference)
Fields
OutputList(Vec<Type>)
Multiple return values captured as a list (internal destructuring helper)
DataDataset
Dataset handle with optional compile-time schema information
Fields
arrays: Option<BTreeMap<String, DataArrayTypeInfo>>DataArray
Data array handle with optional dtype/shape metadata
Fields
DataTransaction
Data transaction handle
Implementations§
Source§impl Type
impl Type
Sourcepub fn logical_with_shape(shape: Vec<usize>) -> Self
pub fn logical_with_shape(shape: Vec<usize>) -> Self
Create a logical type with known shape
Sourcepub fn tensor_with_shape(shape: Vec<usize>) -> Self
pub fn tensor_with_shape(shape: Vec<usize>) -> Self
Create a tensor type with known shape
Sourcepub fn is_compatible_with(&self, other: &Type) -> bool
pub fn is_compatible_with(&self, other: &Type) -> bool
Check if this type is compatible with another type
Sourcepub fn from_value(value: &Value) -> Type
pub fn from_value(value: &Value) -> Type
Infer type from a Value
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Type
impl<'de> Deserialize<'de> for Type
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnsafeUnpin 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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.