Creating Factory classes with pyo3 using enums #5649
achapkowski
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Let's say I have multiple geometry classes and factory class in Python:
and then in Python I create a factory:
What the code does is simply return the specific class based on something defined in the given data called iterable.
So if I give:
{'type' : "point", coords:[1,2]} it returns a Point class. It's pretty simple.
So my idea is that I wanted to do this via rust using enumeration
My issue is that is create an opaque object, and isn't using my defined classes. Can I use this pattern as a factory with pyo3?
Beta Was this translation helpful? Give feedback.
All reactions