pub enum Kind {
Star,
Arrow(Box<Kind>, Box<Kind>),
Constraint,
Var(u32),
Nat,
List(Box<Kind>),
}Expand description
Kinds classify types, just as types classify values.
*(Star): The kind of types that have values (e.g.,Int,Bool)* -> *: The kind of type constructors (e.g.,Maybe,[])Constraint: The kind of type class constraintsNat: The kind of type-level natural numbers (M9)List k: The kind of type-level lists with element kindk(M9)
Variants§
Star
* - The kind of proper types (types that have values).
Arrow(Box<Kind>, Box<Kind>)
k1 -> k2 - The kind of type constructors.
Constraint
Constraint - The kind of type class constraints.
Var(u32)
A kind variable, for kind inference.
Nat
Nat - The kind of type-level natural numbers.
Used for tensor dimensions in shape-indexed types:
Tensor :: [Nat] -> * -> *List(Box<Kind>)
List k - The kind of type-level lists with element kind k.
Primarily used as [Nat] for tensor shapes:
'[1024, 768] :: [Nat]Implementations§
Source§impl Kind
impl Kind
Sourcepub fn star_to_star() -> Self
pub fn star_to_star() -> Self
Returns the kind * -> *.
Sourcepub fn tensor_kind() -> Self
pub fn tensor_kind() -> Self
Returns the kind [Nat] -> * -> * for the Tensor type constructor.
Sourcepub fn list_elem_kind(&self) -> Option<&Kind>
pub fn list_elem_kind(&self) -> Option<&Kind>
Returns the element kind if this is a list kind.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Kind
impl<'de> Deserialize<'de> for Kind
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Kind
impl StructuralPartialEq for Kind
Auto Trait Implementations§
impl Freeze for Kind
impl RefUnwindSafe for Kind
impl Send for Kind
impl Sync for Kind
impl Unpin for Kind
impl UnsafeUnpin for Kind
impl UnwindSafe for Kind
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
Mutably borrows from an owned value. Read more