aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDasEtwas <18222134+DasEtwas@users.noreply.github.com>2021-04-13 01:39:25 +0200
committerDasEtwas <18222134+DasEtwas@users.noreply.github.com>2021-05-06 20:41:13 +0200
commit716c343979cedd7ddbcdc4e7c86d085b3d14f45d (patch)
tree733deedbb0b01a024954d4b47cb651b8485be4bc
parent355f7a3a3934043a330763ca985264cdb1375405 (diff)
downloadrapier-716c343979cedd7ddbcdc4e7c86d085b3d14f45d.tar.gz
rapier-716c343979cedd7ddbcdc4e7c86d085b3d14f45d.tar.bz2
rapier-716c343979cedd7ddbcdc4e7c86d085b3d14f45d.zip
Add #[must_use] to builders, expose more fields
-rw-r--r--src/dynamics/rigid_body.rs30
-rw-r--r--src/geometry/collider.rs1
2 files changed, 17 insertions, 14 deletions
diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs
index 824ec92..1fb7213 100644
--- a/src/dynamics/rigid_body.rs
+++ b/src/dynamics/rigid_body.rs
@@ -564,21 +564,23 @@ impl RigidBody {
}
/// A builder for rigid-bodies.
+#[derive(Copy, Clone, Debug, PartialEq)]
+#[must_use = "Builder functions return the updated builder"]
pub struct RigidBodyBuilder {
- position: Isometry<Real>,
- linvel: Vector<Real>,
- angvel: AngVector<Real>,
- gravity_scale: Real,
- linear_damping: Real,
- angular_damping: Real,
- rb_type: RigidBodyType,
- mprops_flags: RigidBodyMassPropsFlags,
- mass_properties: MassProperties,
- can_sleep: bool,
- sleeping: bool,
- ccd_enabled: bool,
- dominance_group: i8,
- user_data: u128,
+ pub position: Isometry<Real>,
+ pub linvel: Vector<Real>,
+ pub angvel: AngVector<Real>,
+ pub gravity_scale: Real,
+ pub linear_damping: Real,
+ pub angular_damping: Real,
+ pub rb_type: RigidBodyType,
+ pub mprops_flags: RigidBodyMassPropsFlags,
+ pub mass_properties: MassProperties,
+ pub can_sleep: bool,
+ pub sleeping: bool,
+ pub ccd_enabled: bool,
+ pub dominance_group: i8,
+ pub user_data: u128,
}
impl RigidBodyBuilder {
diff --git a/src/geometry/collider.rs b/src/geometry/collider.rs
index 08295c1..c7ceadf 100644
--- a/src/geometry/collider.rs
+++ b/src/geometry/collider.rs
@@ -197,6 +197,7 @@ impl Collider {
/// A structure responsible for building a new collider.
#[derive(Clone)]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
+#[must_use = "Builder functions return the updated builder"]
pub struct ColliderBuilder {
/// The shape of the collider to be built.
pub shape: SharedShape,