pub struct World<T> { /* private fields */ }Implementations§
Source§impl<T> World<T>
impl<T> World<T>
pub fn new() -> Self
pub fn with_cell_size(cell_size: f64) -> Self
pub fn get_item(&self, item: ItemId) -> Option<&T>
pub fn get_rect(&self, item: ItemId) -> Option<Rectangle>
pub fn get_item_mut(&mut self, item: ItemId) -> Option<&mut T>
pub fn contains(&self, item: ItemId) -> bool
pub fn query_rect(&self, rect: Rectangle) -> Vec<ItemId>
pub fn query_point(&self, point: Vec2f) -> Vec<ItemId>
pub fn query_line_segment( &self, start: Vec2f, end: Vec2f, ) -> Vec<LineSegmentQuery>
pub fn add(&mut self, item: T, rect: Rectangle) -> ItemId
pub fn remove(&mut self, index: ItemId) -> Option<(T, Rectangle)>
pub fn update( &mut self, index: ItemId, new_rect: Rectangle, ) -> Option<Rectangle>
pub fn update_position( &mut self, index: ItemId, new_position: Vec2f, ) -> Option<Vec2f>
pub fn check( &self, index: ItemId, goal: Vec2f, collider: impl Fn(ItemId, &T, &RectCollision) -> Option<CollisionResponse>, ) -> Option<(Vec2f, Vec<Collision>)>
pub fn move_item( &mut self, index: ItemId, goal: Vec2f, collider: impl Fn(ItemId, &T, &RectCollision) -> Option<CollisionResponse>, ) -> Option<(Vec2f, Vec<Collision>)>
Auto Trait Implementations§
impl<T> Freeze for World<T>
impl<T> RefUnwindSafe for World<T>where
T: RefUnwindSafe,
impl<T> Send for World<T>where
T: Send,
impl<T> Sync for World<T>where
T: Sync,
impl<T> Unpin for World<T>where
T: Unpin,
impl<T> UnwindSafe for World<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.