pub enum TypeSpec {
Declared(Loc<NameID>, Vec<Loc<TypeExpression>>),
Generic(Loc<NameID>),
Tuple(Vec<Loc<TypeSpec>>),
Array {
inner: Box<Loc<TypeSpec>>,
size: Box<Loc<TypeExpression>>,
},
Inverted(Box<Loc<TypeSpec>>),
Wire(Box<Loc<TypeSpec>>),
TraitSelf(Loc<()>),
Wildcard(Loc<()>),
}Expand description
A specification of a type to be used. For example, the types of input/output arguments the type of fields in a struct etc.
Variants§
Declared(Loc<NameID>, Vec<Loc<TypeExpression>>)
The type is a declared type (struct, enum, typedef etc.) with n arguments
Generic(Loc<NameID>)
The type is a generic argument visible in the current scope
Tuple(Vec<Loc<TypeSpec>>)
The type is a tuple of other variables
Array
Inverted(Box<Loc<TypeSpec>>)
Wire(Box<Loc<TypeSpec>>)
TraitSelf(Loc<()>)
The type of the self parameter in a trait method spec. Should not
occur in non-traits. The Loc is only used for diag_bails, so an approximate
reference is fine.
Wildcard(Loc<()>)
A wildcard, cannot occur everywhere, but ast lowering enusres that wildcards are valid, i.e. it is safe to emit a Diagnostic::bug if this is encountered where it is invalid
Implementations§
Source§impl TypeSpec
impl TypeSpec
pub fn unit() -> Self
pub fn type_params(&self) -> Vec<TypeExpression>
pub fn replace_in(self, from: &TypeSpec, to: &TypeSpec) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TypeSpec
impl<'de> Deserialize<'de> for TypeSpec
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
Source§impl<'a> ParameterListLike<'a, TypeSpec> for ParameterList
impl<'a> ParameterListLike<'a, TypeSpec> for ParameterList
fn as_listlike(&'a self) -> ParameterListWrapper<'a, TypeSpec>
Source§impl PrettyDebug for TypeSpec
impl PrettyDebug for TypeSpec
fn pretty_debug(&self) -> String
Source§impl PrettyPrint for TypeSpec
impl PrettyPrint for TypeSpec
fn pretty_print(&self) -> String
impl Eq for TypeSpec
impl StructuralPartialEq for TypeSpec
Auto Trait Implementations§
impl Freeze for TypeSpec
impl RefUnwindSafe for TypeSpec
impl Send for TypeSpec
impl Sync for TypeSpec
impl Unpin for TypeSpec
impl UnwindSafe for TypeSpec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more