pub enum ProgramEdit {
Insert {
index: usize,
id: Option<String>,
operation: PartOperation,
},
Update {
id: String,
operation: PartOperation,
},
Remove {
id: String,
},
Move {
id: String,
index: usize,
},
Replace {
program: Program,
},
}Expand description
A change to a Program. Every edit of a program — whoever makes it —
is one of these, applied by Program::update.
Steps are addressed by id, not position, so an edit means the same thing
however the steps around it have moved. Serializes as, e.g.,
{"edit": "update", "id": "box", "operation": "extrude", "args": {...}}.
Variants§
Insert
Insert operation as a new step at position index (the end, if it
is the number of steps), with the id id — or, if that is None, a
fresh one derived from the operation (see Program::fresh_id).
Update
Give step id a new operation or new arguments, in place.
Remove
Remove step id. Steps that referred to what it built fail from then
on, until they are edited — the program is left as the user made it.
Move
Move step id to position index among the remaining steps.
Replace
Replace the whole program, e.g. with one loaded from a file.
Implementations§
Trait Implementations§
Source§impl Clone for ProgramEdit
impl Clone for ProgramEdit
Source§fn clone(&self) -> ProgramEdit
fn clone(&self) -> ProgramEdit
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProgramEdit
impl Debug for ProgramEdit
Source§impl<'de> Deserialize<'de> for ProgramEdit
impl<'de> Deserialize<'de> for ProgramEdit
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ProgramEdit
impl PartialEq for ProgramEdit
Source§fn eq(&self, other: &ProgramEdit) -> bool
fn eq(&self, other: &ProgramEdit) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ProgramEdit
impl Serialize for ProgramEdit
impl StructuralPartialEq for ProgramEdit
Auto Trait Implementations§
impl Freeze for ProgramEdit
impl RefUnwindSafe for ProgramEdit
impl Send for ProgramEdit
impl Sync for ProgramEdit
impl Unpin for ProgramEdit
impl UnsafeUnpin for ProgramEdit
impl UnwindSafe for ProgramEdit
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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