fj_core/objects/
is_object.rs

1use crate::storage::Handle;
2
3use super::{
4    Curve, Cycle, Face, HalfEdge, Region, Shell, Sketch, Solid, Surface, Vertex,
5};
6
7/// A trait implemented for all object types
8///
9/// This trait is implemented for both bare objects (`T`) and stored objects
10/// (`Handle<T>`). The `BareObject` associated type provides access to the bare
11/// object type.
12///
13/// This is a piece of infrastructure that is useful for other traits, which
14/// would otherwise have to duplicate its functionality. Users are unlikely to
15/// be affected by this trait.
16pub trait IsObject {
17    /// The type of the bare object
18    type BareObject;
19}
20
21impl IsObject for Curve {
22    type BareObject = Curve;
23}
24
25impl IsObject for Cycle {
26    type BareObject = Cycle;
27}
28
29impl IsObject for Face {
30    type BareObject = Face;
31}
32
33impl IsObject for HalfEdge {
34    type BareObject = HalfEdge;
35}
36
37impl IsObject for Region {
38    type BareObject = Region;
39}
40
41impl IsObject for Shell {
42    type BareObject = Shell;
43}
44
45impl IsObject for Sketch {
46    type BareObject = Sketch;
47}
48
49impl IsObject for Solid {
50    type BareObject = Solid;
51}
52
53impl IsObject for Surface {
54    type BareObject = Surface;
55}
56
57impl IsObject for Vertex {
58    type BareObject = Vertex;
59}
60
61impl IsObject for Handle<Curve> {
62    type BareObject = Curve;
63}
64
65impl IsObject for Handle<Cycle> {
66    type BareObject = Cycle;
67}
68
69impl IsObject for Handle<Face> {
70    type BareObject = Face;
71}
72
73impl IsObject for Handle<HalfEdge> {
74    type BareObject = HalfEdge;
75}
76
77impl IsObject for Handle<Region> {
78    type BareObject = Region;
79}
80
81impl IsObject for Handle<Shell> {
82    type BareObject = Shell;
83}
84
85impl IsObject for Handle<Sketch> {
86    type BareObject = Sketch;
87}
88
89impl IsObject for Handle<Solid> {
90    type BareObject = Solid;
91}
92
93impl IsObject for Handle<Surface> {
94    type BareObject = Surface;
95}
96
97impl IsObject for Handle<Vertex> {
98    type BareObject = Vertex;
99}