Skip to main content

resolve_class_constructor

Function resolve_class_constructor 

Source
fn resolve_class_constructor<'a>(
    blocks: &[&'a ClassBlockEntry],
) -> Result<Vec<&'a ClassBlockEntry>, String>
Expand description

Decide a type’s class constructor across its impl blocks: the blocks to merge, each in the rendering that agrees with the decision.

  • A block that declares the constructor (#[miniextendr(<system>(constructor))], or a receiver-less new returning Self) has it. A block that would infer one takes its demoted rendering, where that method is a static method. Two declaring blocks are refused with the other two-definer cases (merge_class_blocks).
  • Without one, the type’s one candidate is its constructor, whichever block has it. Several candidates are an error naming each with its block (the compiler already refuses several in one block).