#[non_exhaustive]pub enum EditCommand {
Show 14 variants
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,
},
AddHeaderCondition {
rule_id: NodeId,
condition: HeaderConditionPayload,
},
UpdateHeaderCondition {
id: NodeId,
condition: HeaderConditionPayload,
},
RemoveHeaderCondition {
id: NodeId,
},
AddBodyCondition {
rule_id: NodeId,
condition: BodyConditionPayload,
},
UpdateBodyCondition {
id: NodeId,
condition: BodyConditionPayload,
},
RemoveBodyCondition {
id: NodeId,
},
}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).
AddHeaderCondition
Add a single header condition to an existing rule.
rule_id must be the NodeId of the target rule.
UpdateHeaderCondition
Replace a header condition in-place, identified by its NodeId.
The header name (condition.name) may differ from the original —
this counts as a rename, which reassigns the condition’s NodeId.
RemoveHeaderCondition
Remove a single header condition by its NodeId.
AddBodyCondition
Add a single body condition to an existing rule.
UpdateBodyCondition
Replace a body condition in-place, identified by its NodeId.
RemoveBodyCondition
Remove a single body condition by its NodeId.
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