pub struct UserSynonymDecl {
pub name: String,
pub params: Vec<String>,
pub body: TypeExpr,
}Expand description
A user type synonym declaration (type point = length * length),
surfaced in parallel with UserTypeDecl — see that struct’s doc
comment; the body is kept as a raw CST TypeExpr for the same reason.
typecheck::build_synonym_decl is where it is actually lowered to a
MonoType template, and typecheck::expand_synonyms is where a
reference to name elsewhere is transparently replaced by it.
Fields§
§name: String§params: Vec<String>Type-parameter names, in declaration order. Only the zero-param case
is reachable through a use of the synonym today — see
cst::ast::TypeAtom’s doc comment (no applied-type-constructor
syntax exists to instantiate one) — but parsing/storing params keeps
this declaration-side path symmetric with UserTypeDecl.
body: TypeExprTrait Implementations§
Source§impl Clone for UserSynonymDecl
impl Clone for UserSynonymDecl
Source§fn clone(&self) -> UserSynonymDecl
fn clone(&self) -> UserSynonymDecl
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for UserSynonymDecl
impl RefUnwindSafe for UserSynonymDecl
impl Send for UserSynonymDecl
impl Sync for UserSynonymDecl
impl Unpin for UserSynonymDecl
impl UnsafeUnpin for UserSynonymDecl
impl UnwindSafe for UserSynonymDecl
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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