#![no_std]
#![doc = r#"
Cougr is a monolithic-on-the-outside ECS framework for Soroban-compatible applications.
The public API is intentionally split into:
- root re-exports for the onboarding path
- `app` for the default gameplay runtime surface
- `auth` for beta account and session flows
- `privacy` for stable and experimental privacy surfaces
- `ops` for stable operational standards
- `accounts` for account abstraction and session flows
- `zk::stable` for stable privacy primitives
- `zk::experimental` for fast-moving proof-verification APIs
# Golden Path
```rust
use cougr_core::{ComponentTrait, Position, SimpleWorld};
use soroban_sdk::Env;
let env = Env::default();
let mut world = SimpleWorld::new(&env);
let entity = world.spawn_entity();
world.set_typed(&env, entity, &Position::new(1, 2));
let pos: Position = world.get_typed(&env, entity).unwrap();
assert_eq!(pos.x, 1);
```
# Stability
- ECS runtime and storage: Stable
- `app`: Stable
- `standards`: Stable
- Accounts: Beta
- `zk::stable`: Stable
- `zk::experimental`: Experimental
"#]
extern crate alloc;
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[macro_use]
pub mod macros;
pub mod accounts;
pub mod archetype_world;
mod change_tracker;
pub mod commands;
pub mod component;
#[cfg(feature = "debug")]
#[doc(hidden)]
pub mod debug;
pub mod ecs;
pub mod error;
pub mod event;
mod hooks;
mod incremental;
mod observers;
pub mod plugin;
pub mod query;
pub mod resource;
pub mod scheduler;
pub mod simple_world;
pub mod standards;
mod system;
pub mod zk;
pub use archetype_world::{ArchetypeQuery, ArchetypeQueryBuilder, ArchetypeWorld};
pub use commands::CommandQueue;
pub use component::{Component, ComponentId, ComponentStorage, ComponentTrait, Position};
pub use ecs::{RuntimeWorld, RuntimeWorldMut, WorldBackend};
pub use error::{CougrError, CougrResult};
pub use event::{Event, EventReader, EventWriter};
pub use plugin::{GameApp, Plugin, PluginGroup};
pub use query::{QueryStorage, SimpleQuery, SimpleQueryBuilder};
pub use resource::Resource;
pub use resource::ResourceTrait;
pub use scheduler::{ScheduleError, ScheduleStage, SimpleScheduler, SystemConfig, SystemGroup};
pub use simple_world::SimpleWorld;
pub mod app {
pub use super::{
CommandQueue, GameApp, Plugin, PluginGroup, Resource, ResourceTrait, RuntimeWorld,
RuntimeWorldMut, ScheduleError, ScheduleStage, SimpleQuery, SimpleQueryBuilder,
SimpleScheduler, SimpleWorld, SystemConfig, SystemGroup,
};
pub use crate::system::{
context_system, named_app_system, named_context_system, named_system, world_system,
AppSystem, SimpleSystem, SystemContext, SystemSpec,
};
}
pub mod auth {
pub use super::accounts::*;
}
pub mod privacy {
pub use super::zk::{
experimental, stable, G1Point, G2Point, Groth16Proof, Scalar, VerificationKey, ZKError,
};
}
pub mod ops {
pub use super::standards::*;
}
pub mod prelude {
pub use super::simple_world::EntityId;
pub use super::{
ArchetypeWorld, CommandQueue, Component, ComponentStorage, ComponentTrait, GameApp,
PluginGroup, Position, QueryStorage, Resource, RuntimeWorld, RuntimeWorldMut, SimpleQuery,
SimpleQueryBuilder, SimpleWorld, WorldBackend,
};
pub use crate::system::SystemContext;
}
pub mod runtime {
pub use super::observers::ComponentEvent;
pub use super::{
archetype_world::{ArchetypeQueryCache, ArchetypeQueryState},
change_tracker::{ChangeTracker, TrackedWorld},
hooks::{HookRegistry, HookedWorld},
incremental::{StorageWorld, WorldMetadata},
observers::{ObservedWorld, ObserverRegistry},
query::{SimpleQueryCache, SimpleQueryState},
resource::Resource,
system::{
context_system, named_app_system, named_context_system, named_system, world_system,
AppSystem, SimpleSystem, SystemContext, SystemSpec,
},
Event, EventReader, EventWriter, Plugin, PluginGroup, QueryStorage, RuntimeWorld,
RuntimeWorldMut, ScheduleError, ScheduleStage, SimpleQuery, SimpleQueryBuilder,
SimpleScheduler, SystemConfig, WorldBackend,
};
}