rapier2d/dynamics/joint/multibody_joint/
multibody_joint_handle.rs1use crate::data::Index;
2
3#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
5#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
6#[repr(transparent)]
7pub struct MultibodyJointHandle(pub Index);
8
9#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
11#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
12#[repr(transparent)]
13pub struct MultibodyIndex(pub Index);
14
15impl MultibodyJointHandle {
16 pub fn into_raw_parts(self) -> (u32, u32) {
18 self.0.into_raw_parts()
19 }
20
21 pub fn from_raw_parts(id: u32, generation: u32) -> Self {
23 Self(Index::from_raw_parts(id, generation))
24 }
25
26 pub fn invalid() -> Self {
28 Self(Index::from_raw_parts(
29 crate::INVALID_U32,
30 crate::INVALID_U32,
31 ))
32 }
33}
34
35impl Default for MultibodyJointHandle {
36 fn default() -> Self {
37 Self::invalid()
38 }
39}