Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

🔀nexus_policy::policy

Struct Policy

Policy couples a configured DFA with caller defined payload and transition metadata.

Fields

Enum Symbol

DFA alphabet symbol for policies: either a witness TypeName or a concrete sui::object::ID.

Variants

Variant Witness0: std::type_name::TypeNameVariant Uid0: sui::object::ID

Constants

Witness symbol not present in the DFA alphabet.

Function witness_symbol

Construct a symbol from a witness type.

Function uid_symbol_from_uid

Construct a symbol from a specific sui::object::ID.

Function witness_symbol_from_name

Helper to create a witness symbol from a precalculated type name.

Function new

Instantiate a policy with the provided DFA and payload.

Function new_linear

Build a policy that enforces a linear sequence of symbols.

Function id

Policy object ID.

Function data

Borrow immutable access to the policy payload.

Function data_mut

Borrow mutable access to the policy payload.

Function dfa

Borrow the underlying DFA.

Function state

Current state as stored in the DFA basis.

Function state_index

Current state index inside the DFA basis.

Function configured_dfa

Configured DFA with transition metadata.

Function is_accepting

Check if the DFA is in an accepting state.

Function reset

Reset the DFA back to its initial state.

Function register

Register a configuration payload keyed by the witness W.

Function register_uid

Register a configuration payload keyed by object uid.

Function register_for_state

Register a configuration scoped to (state, W).

Function register_uid_for_state

Register a configuration scoped to (state, uid).

Function add_symbol

Add a new symbol to the alphabet with transitions for every state.

Function add_witness_symbol

Add a new witness symbol to the alphabet.

Function add_uid_symbol

Add a new sui::object::UID backed symbol to the alphabet.

Function add_state

Add a new DFA state together with its outgoing transitions.

Function set_transition

Update a transition (state, symbol) → next.

Function set_accepting

Toggle whether a state is accepting.

Function borrow_config

Borrow an immutable reference to the configuration keyed by witness W.

Function borrow_config_for_uid

Borrow an immutable reference to the configuration keyed by object uid.

Function borrow_mut_config

Borrow a mutable reference to the configuration keyed by witness W.

Function borrow_mut_config_for_uid

Borrow a mutable reference to the configuration keyed by object uid.

Function borrow_state_config

Borrow an immutable reference to a configuration registered for (state, W).

Function borrow_state_config_for_uid

Borrow an immutable reference to a configuration registered for (state, uid).

Function borrow_mut_state_config

Borrow a mutable reference to a configuration registered for (state, W).

Function borrow_mut_state_config_for_uid

Borrow a mutable reference to a configuration registered for (state, uid).

Function advance_with_witness

Advance the DFA using witness W as the symbol. Witness is consumed.

Function advance_with_uid

Advance the DFA using an object uid as the symbol.

Function has_witness_symbol

Returns true if the witness symbol exists in the policy alphabet.

Function has_witness_config

Returns true if a configuration has been registered for witness W.

Function has_uid_config

Returns true if a configuration has been registered for object uid.

Function remove_config

Removes metadata keyed by witness W.

Function remove_config_for_uid

Removes metadata keyed by object uid.

Function remove_state_config

Removes metadata for state state and witness W.

Function remove_state_config_for_uid

Removes metadata for state state and object uid.

Last updated