From 716c343979cedd7ddbcdc4e7c86d085b3d14f45d Mon Sep 17 00:00:00 2001 From: DasEtwas <18222134+DasEtwas@users.noreply.github.com> Date: Tue, 13 Apr 2021 01:39:25 +0200 Subject: Add #[must_use] to builders, expose more fields --- src/dynamics/rigid_body.rs | 30 ++++++++++++++++-------------- src/geometry/collider.rs | 1 + 2 files changed, 17 insertions(+), 14 deletions(-) (limited to 'src') 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, - linvel: Vector, - angvel: AngVector, - 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, + pub linvel: Vector, + pub angvel: AngVector, + 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, -- cgit