InstructionKind

Enum InstructionKind 

Source
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

§address: Address

Which memory address to set.

§value: Primitive

What value to set the memory address to.

§

SetValue

Lay out a multi-address value in memory.

Fields

§address: Address

Which memory address to set.

§value_parts: Vec<Primitive>

What values to put into memory.

§

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

§start: Operand

Starting address of the array/object.

§member: Operand

Element index or property name.

§

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.

Fields

§start: Address

List will start at this element.

§elements: Vec<Vec<Primitive>>

Each element

§

BinaryArithmetic

Perform arithmetic on values in memory.

Fields

§arithmetic: BinaryArithmetic

What to do.

§destination: Destination

Write the output to this memory address.

§

UnaryArithmetic

Perform arithmetic on a value in memory.

Fields

§arithmetic: UnaryArithmetic

What to do.

§destination: Destination

Write the output to this memory address.

§

StackPush

Push this data onto the stack.

Fields

§data: Vec<Primitive>

Data that will be pushed.

§

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.

Fields

§data: Vec<Primitive>

Extend whatever is on top of the stack with this new data.

§

Copy

Copy from one address to the other.

Fields

§source: Address

Copy from here.

§length: usize

How many addresses to copy.

§destination: Destination

Copy 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

§source_range: Operand

Start copying from this address.

§destination_range: Operand

Start copying into this address.

§

SketchGroupSet

Write the SketchGroup to its special storage.

Fields

§sketch_group: SketchGroup

What to write.

§destination: usize

Index into the SketchGroup storage vec.

§

SketchGroupAddSegment

Add a path to a SketchGroup.

Fields

§segment: InMemory

Address of a PathSegment which will be added to the SketchGroup.

§source: usize

Where the SketchGroup to modify begins. This is an index into the SketchGroup storage of the memory.

§destination: usize

Where the modified SketchGroup should be written to.

§

SketchGroupSetBasePath

Set the base path of a SketchGroup.

Fields

§source: usize

Where the SketchGroup to modify begins. This is an index into the SketchGroup storage of the memory.

§from: InMemory

Where the base path starts.

§to: InMemory

Where the base path ends.

§name: Option<InMemory>

The name of the base path.

§

SketchGroupCopyFrom

Copy data from a SketchGroup.

Fields

§source: usize

Index into the SketchGroup array.

§offset: usize

Which offset into the SketchGroup’s Vec should copying start at?

§length: usize

How many primitives should be copied?

§destination: Destination

Where 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.

Fields

§source: usize

Which SketchGroup to examine.

§destination: Destination

Where to copy the data.

§

NoOp

Does nothing. Used for debugging.

Fields

§comment: String

Debug message.

§

TransformImportFiles

Transform the response of an API call to ImportFiles, into an OkWebSocketResponse::ImportGeometry.

Fields

§source_import_files_response: InMemory

Where the API response was stored. Read first.

§source_file_paths: InMemory

Where the filenames are stored. Read second.

§destination: Destination

Where to write the ImportGeometry.

Implementations§

Source§

impl InstructionKind

Source

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

Source§

fn clone(&self) -> InstructionKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for InstructionKind

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for InstructionKind

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<InstructionKind> for Instruction

Source§

fn from(kind: InstructionKind) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for InstructionKind

Source§

fn eq(&self, other: &InstructionKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for InstructionKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for InstructionKind

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoResult<T> for T

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,