verticopolis_engine/view/
mod.rs1pub mod layout;
36mod marks;
37mod meta;
38mod reader;
39mod signature;
40mod structure;
41#[cfg(any(feature = "wasm", test))]
42mod tally;
43mod window;
44
45use std::cell::RefCell;
46
47pub use layout::{layout_json, VIEW_LAYOUT_VERSION};
48use marks::FrameMarks;
49pub use meta::meta_since;
50pub(crate) use meta::FIRST_META_REVISION;
51#[doc(hidden)]
52pub use meta::{meta_changed, whole_revision, MetaLog};
53pub use reader::ViewReader;
54pub use structure::structure_view;
55#[cfg(all(feature = "wasm", test))]
56pub(crate) use tally::TallyPasses;
57#[cfg(any(feature = "wasm", test))]
58pub(crate) use tally::{CensusTally, RecyclingCounts};
59pub use window::{PeopleWindow, FLOOR_PAD};
60
61use crate::sim::Simulation;
62
63#[doc(hidden)]
64pub struct ViewState {
67 pub(crate) meta_log: MetaLog,
68 pub(crate) marks: FrameMarks,
69 pub(crate) reader: RefCell<ViewReader>,
70}
71
72impl Default for ViewState {
73 fn default() -> ViewState {
74 ViewState {
75 meta_log: MetaLog::new(),
76 marks: FrameMarks::default(),
77 reader: RefCell::new(ViewReader::new()),
78 }
79 }
80}
81
82#[doc(hidden)]
83pub fn view_frame(sim: &Simulation, full: bool) -> Vec<f64> {
87 sim.tower.view.reader.borrow_mut().frame(sim, full)
88}
89
90#[doc(hidden)]
91pub fn set_people_window(sim: &Simulation, window: Option<PeopleWindow>) {
95 sim.tower.view.reader.borrow_mut().set_people_window(window);
96}
97
98#[cfg(test)]
99#[path = "census_reads_tests.rs"]
100mod census_reads_tests;
101#[cfg(test)]
102#[path = "frame_tests.rs"]
103mod frame_tests;
104#[cfg(test)]
105#[path = "kind_writes_tests.rs"]
106mod kind_writes_tests;
107#[cfg(test)]
108#[path = "layout_tests.rs"]
109mod layout_tests;
110#[cfg(test)]
111#[path = "lexer_tests.rs"]
112mod lexer_tests;
113#[cfg(test)]
114#[path = "marks_guard_tests.rs"]
115mod marks_guard_tests;
116#[cfg(test)]
117#[path = "marks_tests.rs"]
118mod marks_tests;
119#[cfg(test)]
120#[path = "merge_guard_tests.rs"]
121mod merge_guard_tests;
122#[cfg(test)]
123#[path = "meta_tests.rs"]
124mod meta_tests;
125#[cfg(test)]
126#[path = "oracle_tests.rs"]
127mod oracle_tests;
128#[cfg(test)]
129#[path = "session_tests.rs"]
130mod session_tests;
131#[cfg(test)]
132#[path = "signature_tests.rs"]
133mod signature_tests;
134#[cfg(test)]
135#[path = "source_scan_tests.rs"]
136mod source_scan_tests;
137#[cfg(test)]
138#[path = "structure_tests.rs"]
139mod structure_tests;
140#[cfg(test)]
141#[path = "tally_tests.rs"]
142mod tally_tests;
143#[cfg(test)]
144#[path = "unit_scan_tests.rs"]
145mod unit_scan_tests;
146#[cfg(test)]
147#[path = "write_cases_tests.rs"]
148mod write_cases_tests;