Skip to main content

Rules

Trait Rules 

Source
pub trait Rules: Send + Sync {
    // Required methods
    fn successors(&self, node_type: &str) -> Vec<&str>;
    fn roots(&self) -> Vec<&str>;
    fn is_terminal(&self, node_type: &str) -> bool;
    fn is_empty(&self) -> bool;

    // Provided method
    fn param_variants(&self, _node_type: &str) -> Option<(&str, &[String])> { ... }
}
Expand description

遷移制約の抽象化

MutationLogic の R に対する trait bound。 これにより Operator は型パラメータでルールを強制される。

§実装者

  • NodeRules: 汎用的な遷移ルール
  • DependencyGraph: ドメイン固有のグラフ(直接実装も可能)

Required Methods§

Source

fn successors(&self, node_type: &str) -> Vec<&str>

指定 node_type の後に来れる node_type 一覧

Source

fn roots(&self) -> Vec<&str>

ルート node_type 一覧

Source

fn is_terminal(&self, node_type: &str) -> bool

終端かどうか

Source

fn is_empty(&self) -> bool

ルールが空か

Provided Methods§

Source

fn param_variants(&self, _node_type: &str) -> Option<(&str, &[String])>

指定 node_type のパラメータバリアント(キー, 値リスト)

パラメータバリアントが定義されている場合、後続ノード展開時に 各バリアントごとにノードを生成する。

§Returns
  • Some((key, values)): バリアントが定義されている場合
  • None: 定義されていない場合(デフォルト)

Implementors§