-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom TypedShape to reference dyn Shape instead #216
Changes from 1 commit
97aee8f
ca06b10
efd711d
d94b788
dc1b2d3
7043ee6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,7 +150,7 @@ pub enum TypedShape<'a> { | |
#[cfg(feature = "dim2")] | ||
#[cfg(feature = "std")] | ||
RoundConvexPolygon(&'a RoundConvexPolygon), | ||
/// A custom user-defined shape with a type identified by a number. | ||
/// A custom user-defined shape. | ||
Custom(&'a dyn Shape), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Vrixyz This would be difficult due to the |
||
} | ||
impl Debug for TypedShape<'_> { | ||
|
@@ -188,10 +188,14 @@ impl Debug for TypedShape<'_> { | |
Self::RoundCone(arg0) => f.debug_tuple("RoundCone").field(arg0).finish(), | ||
#[cfg(feature = "dim3")] | ||
#[cfg(feature = "std")] | ||
Self::RoundConvexPolyhedron(arg0) => f.debug_tuple("RoundConvexPolyhedron").field(arg0).finish(), | ||
Self::RoundConvexPolyhedron(arg0) => { | ||
f.debug_tuple("RoundConvexPolyhedron").field(arg0).finish() | ||
} | ||
#[cfg(feature = "dim2")] | ||
#[cfg(feature = "std")] | ||
Self::RoundConvexPolygon(arg0) => f.debug_tuple("RoundConvexPolygon").field(arg0).finish(), | ||
Self::RoundConvexPolygon(arg0) => { | ||
f.debug_tuple("RoundConvexPolygon").field(arg0).finish() | ||
} | ||
Self::Custom(_) => f.debug_tuple("Custom").finish(), | ||
} | ||
} | ||
|
@@ -263,9 +267,9 @@ pub(crate) enum DeserializableTypedShape { | |
#[cfg(feature = "dim2")] | ||
#[cfg(feature = "std")] | ||
RoundConvexPolygon(RoundConvexPolygon), | ||
/// A custom user-defined shape identified by a number. | ||
#[allow(dead_code)] // The u32 is needed to match `TypedShape`. | ||
Custom(u32), | ||
/// A custom user-defined shape. | ||
#[allow(dead_code)] | ||
Custom, | ||
} | ||
|
||
#[cfg(feature = "serde-serialize")] | ||
|
@@ -309,7 +313,7 @@ impl DeserializableTypedShape { | |
#[cfg(feature = "dim2")] | ||
#[cfg(feature = "std")] | ||
DeserializableTypedShape::RoundConvexPolygon(s) => Some(SharedShape::new(s)), | ||
DeserializableTypedShape::Custom(_) => None, | ||
DeserializableTypedShape::Custom => None, | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand that custom shapes are (currently) not supported by serialization/deserialization ? (at least here specifically)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct. And this is the same behavior as before.