pub fn register_event<E: Event>(&mut self) -> Result<EventReader<E>, EventManagerError> {
        // Check if the event type is already registered.
        let ty = TypeId::of::<E>();

        if self.channels.contains_key(&ty) {
            return Err(EventManagerError::ChannelAlreadyExist);
        }

        let ec = bounded(64);
        let ec = EventChannel { s: ec.0, r: ec.1 };

        let reader = ec.r.clone();

        self.channels.insert(ty, Box::new(ec));

        Ok(EventReader::from_inner(reader))
    }
/// Register a new event type to event system and return its reader.
Register a new event type to event system and return its reader.
Register a new event type to event system and return its reader .
pub fn register_event<E: Event>(&mut self) -> Result<EventReader<E>, EventManagerError> {
        // Check if the event type is already registered.
        let ty = TypeId::of::<E>();
        if self.channels.contains_key(&ty) {
            return Err(EventManagerError::ChannelAlreadyExist);
        }
        let ec = bounded(64);
        let ec = EventChannel { s: ec.0, r: ec.1 };
        let reader = ec.r.clone();
        self.channels.insert(ty, Box::new(ec));
        Ok(EventReader::from_inner(reader))
    }
pub fn register_event < E : Event > ( & mut self ) -> Result < EventReader < E > , EventManagerError > { // Check if the event type is already registered. let ty = TypeId :: of :: < E > ( ) ; if self . channels . contains_key ( & ty ) { return Err ( EventManagerError :: ChannelAlreadyExist ) ; } let ec = bounded ( 64 ) ; let ec = EventChannel { s : ec . 0 , r : ec . 1 } ; let reader = ec . r . clone ( ) ; self . channels . insert ( ty , Box :: new ( ec ) ) ; Ok ( EventReader :: from_inner ( reader ) ) }
Register a new event type to event system and return its reader.
Register a new event type to event system and return its reader .
&mut self
&mut self