pub struct History { /* private fields */ }Expand description
The engine-owned mutable history.
Implementations§
Source§impl History
impl History
Sourcepub fn from_request_json(json: &str) -> Result<Self, String>
pub fn from_request_json(json: &str) -> Result<Self, String>
Load a whole history document (a saved part file parses as one). Rolls to
the last feature. Ensures a features array exists.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn rollback(&self) -> usize
pub fn rollback(&self) -> usize
The rolled-to index, clamped to a valid feature (0 when empty).
pub fn set_rollback(&mut self, index: usize)
pub fn feature_type(&self, index: usize) -> Option<String>
pub fn feature_id(&self, index: usize) -> Option<String>
pub fn index_of(&self, id: &str) -> Option<usize>
Sourcepub fn feature_params(&self, index: usize) -> Option<Value>
pub fn feature_params(&self, index: usize) -> Option<Value>
The inputParams document of the feature at index (for the dialog).
pub fn set_feature_params(&mut self, index: usize, params: Value)
pub fn push_feature(&mut self, feature: Value)
pub fn remove_feature(&mut self, index: usize)
pub fn swap(&mut self, a: usize, b: usize)
Sourcepub fn next_feature_id(&mut self, base: &str) -> String
pub fn next_feature_id(&mut self, base: &str) -> String
Mint the id for a NEW feature: {base}{N} where base is the feature’s
shortName and N is this history’s persistent GLOBAL counter, bumped by one
on every mint (P.CU → P.CU7, S → S8). GLOBAL across all feature
types, MONOTONIC, and NEVER reused — a delete does not free a number and
undo does not rewind the counter — and it persists across save/load, so two
features can never receive the same id over the document’s whole lifetime.
Sourcepub fn prefix_request(&self) -> Value
pub fn prefix_request(&self) -> Value
The stopAtId-truncated request that stops AFTER the rolled-to feature —
the roll-to-step request the pipeline runs. Empty history → empty request.
Sourcepub fn listing_json(&self) -> String
pub fn listing_json(&self) -> String
The tree listing for the UI: { step, features: [{index, type, id}] }.
Sourcepub fn request_json(&self) -> String
pub fn request_json(&self) -> String
The whole request document (for persistence / debugging), with the
persistent global feature counter folded back in under "featureCounter"
so it round-trips through save/load (the twin of Self::from_request_json,
which lifts it back out). Written only when non-zero, so a document that has
never minted a feature persists byte-for-byte as before (mirrors the
metadata field’s “un-annotated model persists unchanged” convention).
Sourcepub fn can_undo(&self) -> bool
pub fn can_undo(&self) -> bool
Whether an undo step is available (for enabling the toolbar button).
Sourcepub fn undo(&mut self) -> bool
pub fn undo(&mut self) -> bool
Undo the last model mutation: push the current state onto the redo stack and restore the previous document + rolled-to step. Returns whether it changed anything (false when the undo stack is empty).
Sourcepub fn redo(&mut self) -> bool
pub fn redo(&mut self) -> bool
Redo the last undone model mutation (symmetric with Self::undo).
Source§impl History
impl History
Sourcepub fn expressions(&self) -> String
pub fn expressions(&self) -> String
The history document’s expressions source string (empty when absent or
stored as null). The panel’s editor binds to this.
Sourcepub fn set_expressions(&mut self, expressions: &str)
pub fn set_expressions(&mut self, expressions: &str)
Replace the expressions source string. Snapshotted for undo, coalescing a
run of keystroke edits into ONE undo entry (like a slider drag) via the
shared "expressions" coalesce key, so a distinct add/edit/roll starts a
fresh entry. A no-op re-set (same text) still records under the same key.
Sourcepub fn configurator(&self) -> Value
pub fn configurator(&self) -> Value
The configurator object (typed named inputs), or {} when absent —
read-only for the panel’s display (deeper configurator editing deferred).
Source§impl History
impl History
Sourcepub fn feature_persistent_data(&self, index: usize) -> Option<Value>
pub fn feature_persistent_data(&self, index: usize) -> Option<Value>
The persistentData document of the feature at index (None if the
feature or the field is absent) — the read twin of Self::feature_params.
Sourcepub fn set_feature_persistent_field(
&mut self,
index: usize,
key: &str,
value: Value,
)
pub fn set_feature_persistent_field( &mut self, index: usize, key: &str, value: Value, )
Set a single key inside the feature-at-index’s persistentData object,
creating (or replacing a non-object) persistentData as needed. Snapshotted
for undo (a structural edit — never coalesced), like an add/delete.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for History
impl RefUnwindSafe for History
impl Send for History
impl Sync for History
impl Unpin for History
impl UnsafeUnpin for History
impl UnwindSafe for History
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more