Skip to main content

results

Attribute Macro results 

Source
#[results]
Expand description

Derive getter methods and / or result type interfaces for operation results.

Note: It is suggested to use the pliron_op macro instead of using this macro directly. The documention here is useful though, because pliron_op’s results field expands to this macro.

The arguments are a comma-separated list where each entry is:

  • name or name: Type for a named result getter get_result_<name>().
  • _ or _: Type to skip getter generation for that position.

When Type is provided, this macro derives ResultNOfType for the corresponding result index.

The op is allowed to have more results than those specified in the macro arguments. They just won’t have getters or type interfaces generated for them.

use pliron::derive::{def_op, format_op, results, verify_succ};
use pliron::builtin::types::{IntegerType, UnitType};

#[verify_succ]
#[def_op("dialect.with_results")]
#[format_op]
#[results(out: IntegerType, _: UnitType)]
pub struct WithResultsOp {}