pub struct ActorManager<Type, Message> {
pub actors: HashMap<i32, Box<dyn Actor<Type, Message>>>,
/* private fields */
}Expand description
Manages all the actors for the game by hashing actors by id
Fields§
§actors: HashMap<i32, Box<dyn Actor<Type, Message>>>Implementations§
Source§impl<Type, Message> ActorManager<Type, Message>
impl<Type, Message> ActorManager<Type, Message>
pub fn new( actor_gen: ActorFromToken<Type, Message>, ) -> ActorManager<Type, Message>
Sourcepub fn add(
&mut self,
token: char,
position: (i32, i32),
renderer: &mut Renderer<'_>,
)
pub fn add( &mut self, token: char, position: (i32, i32), renderer: &mut Renderer<'_>, )
Add a new actor into the manager
Sourcepub fn temp_remove(&mut self, id: i32) -> Option<Box<dyn Actor<Type, Message>>>
pub fn temp_remove(&mut self, id: i32) -> Option<Box<dyn Actor<Type, Message>>>
Temporarily remove an actor to appease borrow checker
Sourcepub fn get_mut(&mut self, id: i32) -> Option<&mut Box<dyn Actor<Type, Message>>>
pub fn get_mut(&mut self, id: i32) -> Option<&mut Box<dyn Actor<Type, Message>>>
Get a mutable reference to an actor given the id
Sourcepub fn temp_reinsert(&mut self, id: i32, actor: Box<dyn Actor<Type, Message>>)
pub fn temp_reinsert(&mut self, id: i32, actor: Box<dyn Actor<Type, Message>>)
Reinsert a temporarily removed actor
Auto Trait Implementations§
impl<Type, Message> Freeze for ActorManager<Type, Message>
impl<Type, Message> !RefUnwindSafe for ActorManager<Type, Message>
impl<Type, Message> !Send for ActorManager<Type, Message>
impl<Type, Message> !Sync for ActorManager<Type, Message>
impl<Type, Message> Unpin for ActorManager<Type, Message>
impl<Type, Message> !UnwindSafe for ActorManager<Type, Message>
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