style: format rust

This commit is contained in:
dusk 2024-12-06 22:14:54 +03:00
parent c7879ddc05
commit e82751e2bf
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw
4 changed files with 12 additions and 11 deletions

View File

@ -73,8 +73,7 @@ impl INode2D for Boid2D {
} }
fn exit_tree(&mut self) { fn exit_tree(&mut self) {
let mut flock: Gd<Flock2D> = let mut flock: Gd<Flock2D> = Gd::from_instance_id(self.get_flock_id());
Gd::from_instance_id(self.get_flock_id());
flock.bind_mut().unregister_boid(self.get_id()); flock.bind_mut().unregister_boid(self.get_id());
} }
} }

View File

@ -44,7 +44,8 @@ impl Boid3D {
#[inline(always)] #[inline(always)]
/// Get the flock ID of this boid. /// Get the flock ID of this boid.
pub fn get_flock_id(&self) -> InstanceId { pub fn get_flock_id(&self) -> InstanceId {
self.flock_id.expect("no flock id found set... this is a bug!") self.flock_id
.expect("no flock id found set... this is a bug!")
} }
} }
@ -72,8 +73,7 @@ impl INode3D for Boid3D {
} }
fn exit_tree(&mut self) { fn exit_tree(&mut self) {
let mut flock: Gd<Flock3D> = let mut flock: Gd<Flock3D> = Gd::from_instance_id(self.get_flock_id());
Gd::from_instance_id(self.get_flock_id());
flock.bind_mut().unregister_boid(self.get_id()); flock.bind_mut().unregister_boid(self.get_id());
} }
} }

View File

@ -3,13 +3,13 @@ use godot::prelude::*;
use crate::BoidProperties; use crate::BoidProperties;
pub mod flock_properties;
pub mod flock_2d; pub mod flock_2d;
pub mod flock_3d; pub mod flock_3d;
pub mod flock_properties;
pub use flock_properties::*;
pub use flock_2d::*; pub use flock_2d::*;
pub use flock_3d::*; pub use flock_3d::*;
pub use flock_properties::*;
pub trait Flock { pub trait Flock {
fn get_flock_properties(&self) -> &FlockProperties; fn get_flock_properties(&self) -> &FlockProperties;

View File

@ -12,8 +12,8 @@ use rayon::prelude::*;
mod boid; mod boid;
mod flock; mod flock;
pub use boid::{*, Boid}; pub use boid::{Boid, *};
pub use flock::{*, Flock}; pub use flock::{Flock, *};
use rustc_hash::FxBuildHasher; use rustc_hash::FxBuildHasher;
@ -226,8 +226,10 @@ const fn to_glam_vec(godot_vec: Vector3) -> Vec3 {
} }
#[inline(always)] #[inline(always)]
fn process_boids<F, B>(boids: &mut FxIndexMap<InstanceId, Gd<B>>, flocks: &FxIndexMap<InstanceId, Gd<F>>) fn process_boids<F, B>(
where boids: &mut FxIndexMap<InstanceId, Gd<B>>,
flocks: &FxIndexMap<InstanceId, Gd<F>>,
) where
F: Flock + GodotClass, F: Flock + GodotClass,
F: Bounds<Declarer = DeclUser>, F: Bounds<Declarer = DeclUser>,
B: Boid + GodotClass, B: Boid + GodotClass,