pub enum TypeExpr {
Named(Ident),
Unit(Span),
Never(Span),
Array {
element: Box<TypeExpr>,
length: u64,
span: Span,
},
AnonymousStruct {
fields: Vec<AnonStructField>,
methods: Vec<Method>,
span: Span,
},
AnonymousEnum {
variants: Vec<EnumVariant>,
methods: Vec<Method>,
span: Span,
},
PointerConst {
pointee: Box<TypeExpr>,
span: Span,
},
PointerMut {
pointee: Box<TypeExpr>,
span: Span,
},
}Expand description
A type expression in the AST.
Variants§
Named(Ident)
A simple named type (e.g., i32, bool, MyStruct)
Unit(Span)
Unit type: ()
Never(Span)
Never type: !
Array
Array type: [T; N] where T is the element type and N is the length
AnonymousStruct
Anonymous struct type: struct { field: Type, fn method(…) { … }, … }
Used in comptime type construction (e.g., fn Pair(comptime T: type) -> type { struct { first: T, second: T } })
Methods can be included inside the struct definition (Zig-style).
Fields
fields: Vec<AnonStructField>Field declarations (name and type)
AnonymousEnum
Anonymous enum type: enum { Variant, Variant(T), Variant { field: T }, fn method(…) { … }, … }
Used in comptime type construction (e.g., fn Option(comptime T: type) -> type { enum { Some(T), None } })
Methods can be included inside the enum definition (Zig-style).
Fields
variants: Vec<EnumVariant>Enum variants
PointerConst
Raw pointer to immutable data: ptr const T
PointerMut
Raw pointer to mutable data: ptr mut T
Implementations§
Trait Implementations§
impl Eq for TypeExpr
impl StructuralPartialEq for TypeExpr
Auto Trait Implementations§
impl Freeze for TypeExpr
impl RefUnwindSafe for TypeExpr
impl Send for TypeExpr
impl Sync for TypeExpr
impl Unpin for TypeExpr
impl UnwindSafe for TypeExpr
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].