-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b126a8
commit 5e7042a
Showing
5 changed files
with
94 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...n-macros/src/snapshots/kittycad_execution_plan_macros__tests__enum_with_generics.snap.new
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
source: execution-plan-macros/src/lib.rs | ||
assertion_line: 324 | ||
expression: formatted | ||
--- | ||
impl kittycad_execution_plan_traits::Value for Segment { | ||
fn into_parts(self) -> Vec<kittycad_execution_plan_traits::Primitive> { | ||
match self { | ||
Segment::Line { point } => { | ||
vec![ | ||
kittycad_execution_plan_traits::Primitive::from(stringify!(Line).to_owned()), | ||
kittycad_execution_plan_traits::Primitive::from(point), | ||
] | ||
} | ||
} | ||
} | ||
|
||
fn from_parts<I>(values: &mut I) -> Result<Self, kittycad_execution_plan_traits::MemoryError> | ||
where | ||
I: Iterator<Item = Option<kittycad_execution_plan_traits::Primitive>>, | ||
{ | ||
let variant_name = String::from_parts(values)?; | ||
match variant_name.as_str() { | ||
stringify!(Line) => { | ||
let point = Point3d::from_parts(values)?; | ||
Ok(Self::Line { point }) | ||
} | ||
other => Err( | ||
kittycad_execution_plan_traits::MemoryError::InvalidEnumVariant { | ||
expected_type: stringify!(Segment).to_owned(), | ||
actual: other.to_owned(), | ||
}, | ||
), | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters