pub struct ClassSignature {
pub variable: Name,
pub superclasses: Vec<Constraint>,
pub members: Vec<Member>,
pub derivations: Vec<Derivation>,
pub derivations_rejected: bool,
pub span: NodeSpan,
}Expand description
What a class declares that another module can see: its members and superclasses, and the derivations it carries.
It is what Interface::classes carries for each class a
module exposes, and what an importer checks an instance of that class against. The
derivations are in it because a derived instance is usually written beside its type,
in a module other than the class’s, and its members are written out of the bindings
there.
Fields§
§variable: NameThe class variable, a in class Comparable a where.
superclasses: Vec<Constraint>The superclasses, each a constraint on variable.
members: Vec<Member>The member signatures, in the order written.
derivations: Vec<Derivation>The derivations that passed every check, in the order written, at most one per member. A derivation that did not is reported and is not here, so the member it was for is one this class does not derive.
derivations_rejected: boolWhether the module that declares the class rejected one of its derivations: one did not pass the checks a derivation is held to, the class derives some of its members and not the rest, or the type checker rejected one’s binding. That module has reported why, so an instance asking to be derived is not told again that the class is not derivable, and a derived instance’s members do not report the type error a second time.
span: NodeSpanWhere the head line was written, class through where.
Implementations§
Source§impl ClassSignature
impl ClassSignature
Sourcepub fn derivation(&self, member: &Name) -> Option<&Derivation>
pub fn derivation(&self, member: &Name) -> Option<&Derivation>
The derivation of member, when it has one.
Sourcepub fn derivable(&self) -> bool
pub fn derivable(&self) -> bool
Whether an instance of this class may be derived: every member carries a derivation. A class with no member has nothing to derive and is not.
Sourcepub fn walks_one_value(&self) -> bool
pub fn walks_one_value(&self) -> bool
Whether some member’s derivation walks one value, which a () has no element to
begin at.
Trait Implementations§
Source§impl Clone for ClassSignature
impl Clone for ClassSignature
Source§fn clone(&self) -> ClassSignature
fn clone(&self) -> ClassSignature
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more