1#![forbid(unsafe_code)]
13#![warn(missing_docs)]
14#![warn(clippy::pedantic)]
15#![allow(clippy::module_name_repetitions)]
16
17use thiserror::Error;
18
19pub mod components;
20pub mod ecs;
21pub mod game_loop;
22
23pub use components::*;
24pub use ecs::*;
25pub use game_loop::*;
26
27#[derive(Error, Debug, Clone, PartialEq, Eq)]
29pub enum CoreError {
30 #[error("Entity {0:?} not found")]
32 EntityNotFound(Entity),
33
34 #[error("Component not found on entity {0:?}")]
36 ComponentNotFound(Entity),
37
38 #[error("Invalid state transition from {from} to {to}")]
40 InvalidStateTransition {
41 from: String,
43 to: String,
45 },
46}
47
48pub type Result<T> = core::result::Result<T, CoreError>;
50
51#[cfg(test)]
52#[allow(clippy::unwrap_used, clippy::expect_used)]
53mod tests {
54 use super::*;
55
56 #[test]
57 fn test_error_display() {
58 let err = CoreError::EntityNotFound(Entity(42));
59 assert!(err.to_string().contains("42"));
60 }
61}