#[non_exhaustive]pub enum EditCommand {
AddRuleSet {
path: String,
},
RemoveRuleSet {
id: NodeId,
},
AddRule {
parent: NodeId,
rule: RulePayload,
},
UpdateRule {
id: NodeId,
rule: RulePayload,
},
DeleteRule {
id: NodeId,
},
MoveRule {
id: NodeId,
new_index: usize,
},
UpdateRespond {
id: NodeId,
respond: RespondPayload,
},
UpdateRootSetting {
key: RootSettingKey,
value: EditValue,
},
}Expand description
Structured edit command applied via Workspace::apply.
§Shape comes straight from spec §4.3
Each variant targets a node by NodeId (never by positional index). This guarantees edits remain well-defined across previous inserts / removes in the same GUI session.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AddRuleSet
Add a rule set file to the workspace.
path is relative to the root config’s directory — the same
convention as the value stored in service.rule_sets.
RemoveRuleSet
Remove a rule set by its NodeId. The underlying TOML file is NOT deleted from disk — the workspace only removes the reference.
AddRule
Add a rule to an existing rule set.
UpdateRule
Update a rule’s when / respond block.
§Preservation of unspecified fields
RulePayload carries url_path, method, and respond —
the fields a stage-1 GUI form exposes. A rule may also carry
headers and body.json match conditions that aren’t part of
the payload shape. Those clauses are preserved across an
UpdateRule: the new rule keeps whatever headers / body
conditions the previous rule had, even though the payload
doesn’t mention them.
Without this preservation, every UpdateRule would silently
strip the unsurfaced clauses, which is a save-time bug when a
GUI re-saves a rule it loaded from a hand-edited TOML file.
DeleteRule
Remove a rule by NodeId.
MoveRule
Reorder a rule within its parent rule set.
UpdateRespond
Update the respond block of a rule.
UpdateRootSetting
Update a root-level setting (listener, log, service-level flags).
Trait Implementations§
Source§impl Clone for EditCommand
impl Clone for EditCommand
Source§fn clone(&self) -> EditCommand
fn clone(&self) -> EditCommand
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more