pub enum InstructionKind {
Show 20 variants
ApiRequest(ApiRequest),
ImportFiles(ImportFiles),
SetPrimitive {
address: Address,
value: Primitive,
},
SetValue {
address: Address,
value_parts: Vec<Primitive>,
},
AddrOfMember {
start: Operand,
member: Operand,
},
SetList {
start: Address,
elements: Vec<Vec<Primitive>>,
},
BinaryArithmetic {
arithmetic: BinaryArithmetic,
destination: Destination,
},
UnaryArithmetic {
arithmetic: UnaryArithmetic,
destination: Destination,
},
StackPush {
data: Vec<Primitive>,
},
StackPop {
destination: Option<Destination>,
},
StackExtend {
data: Vec<Primitive>,
},
Copy {
source: Address,
length: usize,
destination: Destination,
},
CopyLen {
source_range: Operand,
destination_range: Operand,
},
SketchGroupSet {
sketch_group: SketchGroup,
destination: usize,
},
SketchGroupAddSegment {
segment: InMemory,
source: usize,
destination: usize,
},
SketchGroupSetBasePath {
source: usize,
from: InMemory,
to: InMemory,
name: Option<InMemory>,
},
SketchGroupCopyFrom {
source: usize,
offset: usize,
length: usize,
destination: Destination,
},
SketchGroupGetLastPoint {
source: usize,
destination: Destination,
},
NoOp {
comment: String,
},
TransformImportFiles {
source_import_files_response: InMemory,
source_file_paths: InMemory,
destination: Destination,
},
}Expand description
One step of the execution plan.
Variants§
ApiRequest(ApiRequest)
Call the KittyCAD API.
ImportFiles(ImportFiles)
Import a geometry file.
SetPrimitive
Set a primitive to a memory address.
Fields
SetValue
Lay out a multi-address value in memory.
Fields
AddrOfMember
Find an element/property of an array/object.
Push the element/property’s address onto the stack.
Assumes the object/list is formatted according to Self::SetList documentation.
Fields
SetList
Set a list of elements into memory.
§Format
Lists have this format (each line represents a memory address starting at start):
<number of elements>
<n = size of element 0>
<element 0, address 0>
<...>
<element 0, address n>
<n = size of element 1>
<element 1, address 0>
<...>
<element 1, address n>etc etc for each element.
BinaryArithmetic
Perform arithmetic on values in memory.
Fields
arithmetic: BinaryArithmeticWhat to do.
destination: DestinationWrite the output to this memory address.
UnaryArithmetic
Perform arithmetic on a value in memory.
Fields
arithmetic: UnaryArithmeticWhat to do.
destination: DestinationWrite the output to this memory address.
StackPush
Push this data onto the stack.
StackPop
Pop data off the stack into memory.
Fields
destination: Option<Destination>If Some, the value popped will be stored at the destination. If None, the value won’t be stored anywhere.
StackExtend
Add the given primitives to whatever is on top of the stack. If the stack is empty, runtime error.
Copy
Copy from one address to the other.
Fields
destination: DestinationCopy to here.
CopyLen
Copy data from a range of addresses, into another range of addresses.
The first address in the source range is the length (how many addresses to copy).
If that address contains a uint, that uint is the length.
If that address contains a List/Object header, the size field is the length.
Source range is evaluated before destination range (this is only relevant if both source
and destination come from the stack).
Fields
SketchGroupSet
Write the SketchGroup to its special storage.
Fields
sketch_group: SketchGroupWhat to write.
SketchGroupAddSegment
Add a path to a SketchGroup.
Fields
SketchGroupSetBasePath
Set the base path of a SketchGroup.
Fields
SketchGroupCopyFrom
Copy data from a SketchGroup.
Fields
destination: DestinationWhere to copy them to.
SketchGroupGetLastPoint
Get the to end of the last path segment, i.e. the point from which the next segment will start.
NoOp
Does nothing. Used for debugging.
TransformImportFiles
Transform the response of an API call to ImportFiles, into an OkWebSocketResponse::ImportGeometry.
Implementations§
Source§impl InstructionKind
impl InstructionKind
Sourcepub async fn execute(
self,
mem: &mut Memory,
session: &mut Option<Session>,
events: &mut EventWriter,
batch_queue: &mut ModelingBatch,
) -> Result<(), ExecutionError>
pub async fn execute( self, mem: &mut Memory, session: &mut Option<Session>, events: &mut EventWriter, batch_queue: &mut ModelingBatch, ) -> Result<(), ExecutionError>
Execute the instruction
Trait Implementations§
Source§impl Clone for InstructionKind
impl Clone for InstructionKind
Source§fn clone(&self) -> InstructionKind
fn clone(&self) -> InstructionKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InstructionKind
impl Debug for InstructionKind
Source§impl<'de> Deserialize<'de> for InstructionKind
impl<'de> Deserialize<'de> for InstructionKind
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 From<InstructionKind> for Instruction
impl From<InstructionKind> for Instruction
Source§fn from(kind: InstructionKind) -> Self
fn from(kind: InstructionKind) -> Self
Source§impl PartialEq for InstructionKind
impl PartialEq for InstructionKind
Source§impl Serialize for InstructionKind
impl Serialize for InstructionKind
impl StructuralPartialEq for InstructionKind
Auto Trait Implementations§
impl Freeze for InstructionKind
impl RefUnwindSafe for InstructionKind
impl Send for InstructionKind
impl Sync for InstructionKind
impl Unpin for InstructionKind
impl UnwindSafe for InstructionKind
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,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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