-
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Via Andrei:
Another unrelated interesting thought is not having metadata wrapped in Option
.
If the user does not want metadata, they can set S = ()
.
If they do want it always, they say S = Something
.
If they do want it sometimes, they say S = Option<Something>
.
#[derive(Debug, Clone)]
pub struct CSG<S: Clone> {
pub something: SomeStorage<S>,
pub metadata: S,
}
This may also lead to a neat solution that simplifies all the CSG constructor methods.
They could instead return CSG<()>
, and CSG
could for example have a method with_meta<SNew: Clone>(self, m: SNew) -> CSG<SNew>
(or map_meta(...)
etc.).
Then the workflow could be:
let a = CSG::sphere(...).with_meta(Color::BLUE);
let b = CSG::cylinder(...).with_meta(Color::RED);
let c = a.intersection(b);
ftvkyo
Metadata
Metadata
Assignees
Labels
No labels