Skip to main content

ixa/
lib.rs

1//! A framework for building discrete-event simulations
2//!
3//! Ixa is a framework designed to support the creation of large-scale
4//! discrete event simulations. The primary use case is the construction of
5//! agent-based models for disease transmission, but the approach is applicable
6//! in a wide array of circumstances.
7//!
8//! The central object of an Ixa simulation is the `Context` that is
9//! responsible for managing all the behavior of the simulation. All of the
10//! simulation-specific logic is embedded in modules that rely on the `Context`
11//! for core services such as:
12//! * Maintaining a notion of time for the simulation
13//! * Scheduling events to occur at some point in the future and executing them
14//!   at that time
15//! * Holding module-specific data so that the module and other modules can
16//!   access it
17//!
18//! In practice, a simulation usually consists of a set of modules that work
19//! together to provide all of the functions of the simulation. For instance,
20//! a simple disease transmission model might consist of the
21//! following modules:
22//! * A population loader that initializes the set of people represented
23//!   by the simulation.
24//! * An infection seeder that introduces the pathogen into the population.
25//! * A disease progression manager that transitions infected people through
26//!   stages of disease until recovery.
27//! * A transmission manager that models the process of an infected
28//!   person trying to infect susceptible people in the population.
29//!
30//! ## Features
31//!
32//! - **`logging`**: enables structured logging for native and wasm targets.
33//! - **`profiling`**: enables collection and reporting of execution profiling statistics. Disabled by default.
34
35#![doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/docs/book/src/cli-usage.md"))]
36
37pub mod context;
38pub use context::{Context, ContextBase, ExecutionPhase, IxaEvent};
39
40mod plugin_context;
41pub use plugin_context::PluginContext;
42
43mod data_plugin;
44pub use data_plugin::*;
45
46pub mod error;
47pub use error::IxaError;
48
49pub mod global_properties;
50pub use global_properties::{ContextGlobalPropertiesExt, GlobalProperty};
51
52pub mod network;
53pub use network::{ContextNetworkExt, Edge, EdgeType};
54
55pub mod macros;
56
57pub mod plan;
58pub mod random;
59pub use random::{ContextRandomExt, RngId};
60
61pub mod report;
62pub use report::{ConfigReportOptions, ContextReportExt, Report};
63
64pub mod runner;
65pub use runner::{run_with_args, run_with_custom_args, BaseArgs};
66
67pub mod log;
68pub use log::{
69    debug, disable_logging, enable_logging, error, info, set_log_level, set_module_filter,
70    set_module_filters, trace, warn, LevelFilter,
71};
72
73pub mod hashing;
74pub mod numeric;
75
76// Re-export for macros
77pub use csv;
78pub use ctor;
79pub use ixa_derive::{
80    canonical_from_sorted_query_parts_closure, impl_make_canonical, impl_people_make_canonical,
81    reorder_closure, sorted_tag, sorted_value_type, unreorder_closure,
82};
83pub use paste;
84pub use rand;
85pub use rkyv;
86
87// Deterministic hashing data structures
88pub use crate::hashing::{HashMap, HashMapExt, HashSet, HashSetExt};
89
90// Preludes
91pub mod prelude;
92
93pub mod prelude_for_plugins {
94    pub use ixa_derive::IxaEvent;
95
96    pub use crate::context::{ContextBase, IxaEvent};
97    pub use crate::define_data_plugin;
98    pub use crate::error::IxaError;
99    pub use crate::prelude::*;
100}
101
102pub mod entity;
103pub use entity::{ContextEntitiesExt, EntityPropertyTuple};
104
105pub mod execution_stats;
106pub mod profiling;
107
108pub mod data_structures;