pkecs 9.0.0

Another ECS implementation.
Documentation
//! Types for containing ECS state.

use crate::cell::UncheckedCell;
use super::{component::Components, event::EventQueues};

/// The primary data store for the ECS.
#[derive(Default)]
pub struct World {
    components: Components,
    events: EventQueues,
}

impl World {
    /// Returns an immutable reference to [`Components`].
    pub const fn components(&self) -> &Components {
        &self.components
    }

    /// Returns a mutable reference to [`Components`].
    pub const fn components_mut(&mut self) -> &mut Components {
        &mut self.components
    }

    /// Returns an immutable reference to [`EventQueues`].
    pub const fn events(&self) -> &EventQueues {
        &self.events
    }

    /// Returns a mutable reference to [`EventQueues`].
    pub const fn events_mut(&mut self) -> &mut EventQueues {
        &mut self.events
    }
}

/// A [`World`] wrapped in a [`UncheckedCell`].
///
/// This facilitates most of the functionality provided by pkecs.
///
/// SAFETY:
/// Note that this is 'unsafe' for a reason, you must uphold safety guarantees.
pub type UnsafeWorldCell = UncheckedCell<World>;