Type check and coerce arguments to user functions and return values from std Rust functions (#6958)
* Shuffle around function call code Signed-off-by: Nick Cameron <nrc@ncameron.org> * Refactor function calls to share more code Signed-off-by: Nick Cameron <nrc@ncameron.org> * Hack to leave the result of revolve as a singleton rather than array Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -2,18 +2,17 @@ use fnv::FnvHashMap;
|
||||
use indexmap::IndexMap;
|
||||
use kittycad_modeling_cmds::{
|
||||
self as kcmc,
|
||||
id::ModelingCmdId,
|
||||
ok_response::OkModelingCmdResponse,
|
||||
shared::ExtrusionFaceCapType,
|
||||
websocket::{BatchResponse, OkWebSocketResponseData, WebSocketResponse},
|
||||
EnableSketchMode, ModelingCmd,
|
||||
};
|
||||
use schemars::JsonSchema;
|
||||
use serde::{ser::SerializeSeq, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::{
|
||||
errors::KclErrorDetails,
|
||||
execution::ArtifactId,
|
||||
parsing::ast::types::{Node, Program},
|
||||
KclError, NodePath, SourceRange,
|
||||
};
|
||||
@ -58,52 +57,6 @@ impl PartialOrd for ArtifactCommand {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Serialize, PartialEq, Eq, Ord, PartialOrd, Hash, ts_rs::TS, JsonSchema)]
|
||||
#[ts(export_to = "Artifact.ts")]
|
||||
pub struct ArtifactId(Uuid);
|
||||
|
||||
impl ArtifactId {
|
||||
pub fn new(uuid: Uuid) -> Self {
|
||||
Self(uuid)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Uuid> for ArtifactId {
|
||||
fn from(uuid: Uuid) -> Self {
|
||||
Self::new(uuid)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&Uuid> for ArtifactId {
|
||||
fn from(uuid: &Uuid) -> Self {
|
||||
Self::new(*uuid)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ArtifactId> for Uuid {
|
||||
fn from(id: ArtifactId) -> Self {
|
||||
id.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ArtifactId> for Uuid {
|
||||
fn from(id: &ArtifactId) -> Self {
|
||||
id.0
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ModelingCmdId> for ArtifactId {
|
||||
fn from(id: ModelingCmdId) -> Self {
|
||||
Self::new(*id.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&ModelingCmdId> for ArtifactId {
|
||||
fn from(id: &ModelingCmdId) -> Self {
|
||||
Self::new(*id.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
pub type DummyPathToNode = Vec<()>;
|
||||
|
||||
fn serialize_dummy_path_to_node<S>(_path_to_node: &DummyPathToNode, serializer: S) -> Result<S::Ok, S::Error>
|
||||
|
Reference in New Issue
Block a user