Enum macrohelper::Ty
[−]
pub enum Ty { Slice(Box<Ty>), Array(Box<Ty>, ConstExpr), Ptr(Box<MutTy>), Rptr(Option<Lifetime>, Box<MutTy>), BareFn(Box<BareFnTy>), Never, Tup(Vec<Ty>), Path(Option<QSelf>, Path), ObjectSum(Box<Ty>, Vec<TyParamBound>), PolyTraitRef(Vec<TyParamBound>), ImplTrait(Vec<TyParamBound>), Paren(Box<Ty>), Infer, }
The different kinds of types recognized by the compiler
Variants
Slice(Box<Ty>)
A variable-length array ([T]
)
Array(Box<Ty>, ConstExpr)
A fixed length array ([T; n]
)
Ptr(Box<MutTy>)
A raw pointer (*const T
or *mut T
)
Rptr(Option<Lifetime>, Box<MutTy>)
A reference (&'a T
or &'a mut T
)
BareFn(Box<BareFnTy>)
A bare function (e.g. fn(usize) -> bool
)
Never
The never type (!
)
Tup(Vec<Ty>)
A tuple ((A, B, C, D, ...)
)
Path(Option<QSelf>, Path)
A path (module::module::...::Type
), optionally
"qualified", e.g. <Vec<T> as SomeTrait>::SomeType
.
Type parameters are stored in the Path itself
ObjectSum(Box<Ty>, Vec<TyParamBound>)
Something like A+B
. Note that B
must always be a path.
PolyTraitRef(Vec<TyParamBound>)
A type like for<'a> Foo<&'a Bar>
ImplTrait(Vec<TyParamBound>)
An impl TraitA+TraitB
type.
Paren(Box<Ty>)
No-op; kept solely so that we can pretty-print faithfully
Infer
TyKind::Infer means the type should be inferred instead of it having been specified. This can appear anywhere in a type.
Trait Implementations
impl Debug for Ty
fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.
impl ToTokens for Ty
fn to_tokens(&self, tokens: &mut Tokens)
impl PartialEq<Ty> for Ty
fn eq(&self, __arg_0: &Ty) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Ty) -> bool
This method tests for !=
.
impl Clone for Ty
fn clone(&self) -> Ty
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more