Skip to main content

EditCommand

Enum EditCommand 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

Fields

§path: String
§

RemoveRuleSet

Remove a rule set by its NodeId. The underlying TOML file is NOT deleted from disk — the workspace only removes the reference.

Fields

§

AddRule

Add a rule to an existing rule set.

Fields

§parent: NodeId
§

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.

Fields

§

DeleteRule

Remove a rule by NodeId.

Fields

§

MoveRule

Reorder a rule within its parent rule set.

Fields

§new_index: usize
§

UpdateRespond

Update the respond block of a rule.

Fields

§

UpdateRootSetting

Update a root-level setting (listener, log, service-level flags).

Fields

§

AddHeaderCondition

Add a single header condition to an existing rule.

rule_id must be the NodeId of the target rule.

Fields

§rule_id: NodeId
§

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.

Fields

§

AddBodyCondition

Add a single body condition to an existing rule.

Fields

§rule_id: NodeId
§

UpdateBodyCondition

Replace a body condition in-place, identified by its NodeId.

Fields

§

RemoveBodyCondition

Remove a single body condition by its NodeId.

Fields

Trait Implementations§

Source§

impl Clone for EditCommand

Source§

fn clone(&self) -> EditCommand

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EditCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more