diff --git a/abstutil/src/lib.rs b/abstutil/src/lib.rs index 6406d814ba..214ce64aea 100644 --- a/abstutil/src/lib.rs +++ b/abstutil/src/lib.rs @@ -5,14 +5,6 @@ // - A/B Street-specific filesystem paths // - true utility functions (collections, prettyprinting, CLI parsing -mod abst_paths; -mod cli; -mod collections; -mod io; -mod serde; -mod time; -mod utils; - #[macro_use] extern crate log; @@ -33,4 +25,10 @@ pub use collections::*; pub use time::*; pub use utils::*; +mod cli; +mod collections; +mod io; +mod random; +mod time; + const PROGRESS_FREQUENCY_SECONDS: f64 = 0.2; diff --git a/convert_osm/src/lib.rs b/convert_osm/src/lib.rs index 36a6d76d28..be77974ef8 100644 --- a/convert_osm/src/lib.rs +++ b/convert_osm/src/lib.rs @@ -1,3 +1,8 @@ +use abstutil::Timer; +use geom::{Distance, FindClosest, GPSBounds, LonLat, Pt2D, Ring}; +use map_model::raw::RawMap; +use map_model::{osm, MapConfig, NamePerLanguage}; + mod clip; mod extract; mod parking; @@ -7,11 +12,6 @@ mod split_ways; mod srtm; mod transit; -use abstutil::Timer; -use geom::{Distance, FindClosest, GPSBounds, LonLat, Pt2D, Ring}; -use map_model::raw::RawMap; -use map_model::{osm, MapConfig, NamePerLanguage}; - pub struct Options { pub osm_input: String, pub city_name: String, diff --git a/game/src/common/mod.rs b/game/src/common/mod.rs index 1d1eef8bd6..16b9c14612 100644 --- a/game/src/common/mod.rs +++ b/game/src/common/mod.rs @@ -1,11 +1,3 @@ -mod city_picker; -mod colors; -mod heatmap; -mod isochrone; -mod minimap; -mod navigate; -mod warp; - pub use self::city_picker::CityPicker; pub use self::colors::{ColorDiscrete, ColorLegend, ColorNetwork, ColorScale, DivergingScale}; pub use self::heatmap::{make_heatmap, HeatmapOptions}; @@ -24,6 +16,14 @@ use widgetry::{ ScreenDims, ScreenPt, ScreenRectangle, Text, VerticalAlignment, Widget, }; +mod city_picker; +mod colors; +mod heatmap; +mod isochrone; +mod minimap; +mod navigate; +mod warp; + // TODO This is now just used in two modes... pub struct CommonState { // TODO Better to express these as mutex diff --git a/game/src/debug/mod.rs b/game/src/debug/mod.rs index f172d10c1d..713d8829db 100644 --- a/game/src/debug/mod.rs +++ b/game/src/debug/mod.rs @@ -1,9 +1,3 @@ -mod floodfill; -mod objects; -pub mod path_counter; -mod polygons; -pub mod shared_row; - use crate::app::{App, ShowLayers, ShowObject}; use crate::common::{tool_panel, CommonState, ContextualActions}; use crate::game::{ChooseSomething, DrawBaselayer, PopupMsg, PromptInput, State, Transition}; @@ -21,6 +15,12 @@ use widgetry::{ HorizontalAlignment, Key, Line, Outcome, Panel, Text, UpdateType, VerticalAlignment, Widget, }; +mod floodfill; +mod objects; +pub mod path_counter; +mod polygons; +pub mod shared_row; + pub struct DebugMode { panel: Panel, common: CommonState, diff --git a/game/src/devtools/mod.rs b/game/src/devtools/mod.rs index 5c0d6750e4..7c7a2fcfc3 100644 --- a/game/src/devtools/mod.rs +++ b/game/src/devtools/mod.rs @@ -1,10 +1,3 @@ -mod destinations; -mod kml; -pub mod mapping; -mod polygon; -mod scenario; -mod story; - use crate::app::App; use crate::common::CityPicker; use crate::game::{ChooseSomething, DrawBaselayer, State, Transition}; @@ -16,6 +9,13 @@ use widgetry::{ VerticalAlignment, Widget, }; +mod destinations; +mod kml; +pub mod mapping; +mod polygon; +mod scenario; +mod story; + pub struct DevToolsMode { panel: Panel, } diff --git a/game/src/edit/mod.rs b/game/src/edit/mod.rs index d9d0ea22f9..cf7797bdf0 100644 --- a/game/src/edit/mod.rs +++ b/game/src/edit/mod.rs @@ -1,13 +1,3 @@ -mod bulk; -mod cluster_traffic_signals; -mod lanes; -mod routes; -mod select; -mod stop_signs; -mod traffic_signals; -mod validate; -mod zones; - pub use self::cluster_traffic_signals::ClusterTrafficSignalEditor; pub use self::lanes::LaneEditor; pub use self::routes::RouteEditor; @@ -32,6 +22,16 @@ use widgetry::{ Outcome, Panel, Text, TextExt, VerticalAlignment, Widget, }; +mod bulk; +mod cluster_traffic_signals; +mod lanes; +mod routes; +mod select; +mod stop_signs; +mod traffic_signals; +mod validate; +mod zones; + pub struct EditMode { tool_panel: Panel, top_center: Panel, diff --git a/game/src/edit/traffic_signals/mod.rs b/game/src/edit/traffic_signals/mod.rs index e01e7a8977..589e5b044e 100644 --- a/game/src/edit/traffic_signals/mod.rs +++ b/game/src/edit/traffic_signals/mod.rs @@ -1,8 +1,3 @@ -mod edits; -mod offsets; -mod picker; -mod preview; - use crate::app::{App, ShowEverything}; use crate::common::{CommonState, Warping}; use crate::edit::{apply_map_edits, ConfirmDiscard}; @@ -22,6 +17,11 @@ use widgetry::{ MultiButton, Outcome, Panel, RewriteColor, Text, TextExt, VerticalAlignment, Widget, }; +mod edits; +mod offsets; +mod picker; +mod preview; + // Welcome to one of the most overwhelmingly complicated parts of the UI... pub struct TrafficSignalEditor { diff --git a/game/src/info/mod.rs b/game/src/info/mod.rs index 993c5d7417..77bcaf8cec 100644 --- a/game/src/info/mod.rs +++ b/game/src/info/mod.rs @@ -1,12 +1,3 @@ -mod building; -mod bus; -mod debug; -mod intersection; -mod lane; -mod parking_lot; -mod person; -mod trip; - use crate::app::App; use crate::common::Warping; use crate::debug::path_counter::PathCounter; @@ -27,6 +18,15 @@ use widgetry::{ LinePlot, Outcome, Panel, PlotOptions, Series, TextExt, VerticalAlignment, Widget, }; +mod building; +mod bus; +mod debug; +mod intersection; +mod lane; +mod parking_lot; +mod person; +mod trip; + pub struct InfoPanel { tab: Tab, time: Time, diff --git a/game/src/layer/mod.rs b/game/src/layer/mod.rs index 9ae9e7a8bd..86b4062007 100644 --- a/game/src/layer/mod.rs +++ b/game/src/layer/mod.rs @@ -1,3 +1,10 @@ +use crate::app::App; +use crate::common::HeatmapOptions; +use crate::game::{DrawBaselayer, State, Transition}; +use crate::helpers::hotkey_btn; +use crate::sandbox::dashboards; +use widgetry::{Btn, EventCtx, GfxCtx, Key, Line, Outcome, Panel, TextExt, Widget}; + mod elevation; pub mod map; mod pandemic; @@ -6,13 +13,6 @@ mod population; pub mod traffic; pub mod transit; -use crate::app::App; -use crate::common::HeatmapOptions; -use crate::game::{DrawBaselayer, State, Transition}; -use crate::helpers::hotkey_btn; -use crate::sandbox::dashboards; -use widgetry::{Btn, EventCtx, GfxCtx, Key, Line, Outcome, Panel, TextExt, Widget}; - // TODO Good ideas in // https://towardsdatascience.com/top-10-map-types-in-data-visualization-b3a80898ea70 diff --git a/game/src/lib.rs b/game/src/lib.rs index 89230e05b7..58d4cad0af 100644 --- a/game/src/lib.rs +++ b/game/src/lib.rs @@ -1,3 +1,12 @@ +#[macro_use] +extern crate log; + +use abstutil::{CmdArgs, Timer}; +use geom::Duration; +use sim::SimFlags; + +use crate::app::Flags; + mod app; mod challenges; mod colors; @@ -15,14 +24,6 @@ mod pregame; mod render; mod sandbox; -#[macro_use] -extern crate log; - -use crate::app::Flags; -use abstutil::{CmdArgs, Timer}; -use geom::Duration; -use sim::SimFlags; - pub fn main() { let mut args = CmdArgs::new(); diff --git a/game/src/render/mod.rs b/game/src/render/mod.rs index 7f21549c1d..2ff148922d 100644 --- a/game/src/render/mod.rs +++ b/game/src/render/mod.rs @@ -1,17 +1,3 @@ -mod area; -mod bike; -mod building; -mod bus_stop; -mod car; -mod intersection; -mod lane; -mod map; -mod parking_lot; -mod pedestrian; -mod road; -pub mod traffic_signal; -mod turn; - use crate::app::App; use crate::colors::ColorScheme; use crate::helpers::ID; @@ -28,6 +14,20 @@ use map_model::{IntersectionID, Map}; use sim::{DrawCarInput, VehicleType}; use widgetry::{GfxCtx, Prerender}; +mod area; +mod bike; +mod building; +mod bus_stop; +mod car; +mod intersection; +mod lane; +mod map; +mod parking_lot; +mod pedestrian; +mod road; +pub mod traffic_signal; +mod turn; + pub const BIG_ARROW_THICKNESS: Distance = Distance::const_meters(0.5); pub const CROSSWALK_LINE_THICKNESS: Distance = Distance::const_meters(0.15); diff --git a/game/src/sandbox/dashboards/mod.rs b/game/src/sandbox/dashboards/mod.rs index b42f782da0..cbe2cf324e 100644 --- a/game/src/sandbox/dashboards/mod.rs +++ b/game/src/sandbox/dashboards/mod.rs @@ -1,3 +1,10 @@ +use crate::app::App; +use crate::game::Transition; +pub use commuter::CommuterPatterns; +pub use traffic_signals::TrafficSignalDemand; +pub use trip_table::FinishedTripTable; +use widgetry::{Btn, Choice, EventCtx, Key, Line, Panel, TextExt, Widget}; + mod commuter; mod generic_trip_table; mod misc; @@ -7,13 +14,6 @@ mod table; mod traffic_signals; mod trip_table; -use crate::app::App; -use crate::game::Transition; -pub use commuter::CommuterPatterns; -pub use traffic_signals::TrafficSignalDemand; -pub use trip_table::FinishedTripTable; -use widgetry::{Btn, Choice, EventCtx, Key, Line, Panel, TextExt, Widget}; - // Oh the dashboards melted, but we still had the radio #[derive(Clone, Copy, PartialEq, Debug)] pub enum DashTab { diff --git a/game/src/sandbox/gameplay/mod.rs b/game/src/sandbox/gameplay/mod.rs index 3842ccc2b1..8a69f48aab 100644 --- a/game/src/sandbox/gameplay/mod.rs +++ b/game/src/sandbox/gameplay/mod.rs @@ -1,10 +1,3 @@ -// TODO pub so challenges can grab cutscenes and SandboxMode can dispatch to actions. Weird? -pub mod commute; -pub mod fix_traffic_signals; -pub mod freeform; -pub mod play_scenario; -pub mod tutorial; - pub use self::freeform::spawn_agents_around; pub use self::tutorial::{Tutorial, TutorialPointer, TutorialState}; use crate::app::App; @@ -22,6 +15,13 @@ use widgetry::{ lctrl, Btn, Color, EventCtx, GeomBatch, GfxCtx, Key, Line, Outcome, Panel, TextExt, Widget, }; +// TODO pub so challenges can grab cutscenes and SandboxMode can dispatch to actions. Weird? +pub mod commute; +pub mod fix_traffic_signals; +pub mod freeform; +pub mod play_scenario; +pub mod tutorial; + #[derive(PartialEq, Eq, PartialOrd, Ord, Clone)] pub enum GameplayMode { // TODO Maybe this should be "sandbox" diff --git a/game/src/sandbox/mod.rs b/game/src/sandbox/mod.rs index 068ac0fb61..826166dcb9 100644 --- a/game/src/sandbox/mod.rs +++ b/game/src/sandbox/mod.rs @@ -1,10 +1,3 @@ -pub mod dashboards; -pub mod gameplay; -mod misc_tools; -mod speed; -mod time_warp; -mod uber_turns; - use self::misc_tools::{RoutePreview, TurnExplorer}; use crate::app::App; use crate::common::{tool_panel, CommonState, ContextualActions, IsochroneViewer, Minimap}; @@ -30,6 +23,13 @@ use widgetry::{ TextExt, UpdateType, VerticalAlignment, Widget, }; +pub mod dashboards; +pub mod gameplay; +mod misc_tools; +mod speed; +mod time_warp; +mod uber_turns; + pub struct SandboxMode { gameplay: Box, pub gameplay_mode: GameplayMode, diff --git a/geom/src/lib.rs b/geom/src/lib.rs index e408a81299..04e956469b 100644 --- a/geom/src/lib.rs +++ b/geom/src/lib.rs @@ -1,20 +1,3 @@ -mod angle; -mod bounds; -mod circle; -mod distance; -mod duration; -mod find_closest; -mod gps; -mod line; -mod percent; -mod polygon; -mod polyline; -mod pt; -mod ring; -mod speed; -mod stats; -mod time; - pub use crate::angle::Angle; pub use crate::bounds::{Bounds, GPSBounds}; pub use crate::circle::Circle; @@ -32,6 +15,23 @@ pub use crate::speed::Speed; pub use crate::stats::{HgramValue, Histogram, Statistic}; pub use crate::time::Time; +mod angle; +mod bounds; +mod circle; +mod distance; +mod duration; +mod find_closest; +mod gps; +mod line; +mod percent; +mod polygon; +mod polyline; +mod pt; +mod ring; +mod speed; +mod stats; +mod time; + // About 0.4 inches... which is quite tiny on the scale of things. :) pub const EPSILON_DIST: Distance = Distance::const_meters(0.01); diff --git a/importer/src/main.rs b/importer/src/main.rs index bd80bb8801..a701c563a0 100644 --- a/importer/src/main.rs +++ b/importer/src/main.rs @@ -1,3 +1,6 @@ +use configuration::{load_configuration, ImporterConfiguration}; +use dependencies::are_dependencies_callable; + mod berlin; mod configuration; mod dependencies; @@ -10,9 +13,6 @@ mod tel_aviv; mod utils; mod xian; -use configuration::{load_configuration, ImporterConfiguration}; -use dependencies::are_dependencies_callable; - // TODO Might be cleaner to express as a dependency graph? struct Job { diff --git a/importer/src/soundcast/mod.rs b/importer/src/soundcast/mod.rs index 135c554a6d..d360ba5a1f 100644 --- a/importer/src/soundcast/mod.rs +++ b/importer/src/soundcast/mod.rs @@ -1,5 +1,5 @@ -mod popdat; -mod trips; - pub use self::popdat::{import_data, PopDat}; pub use self::trips::{make_weekday_scenario, make_weekday_scenario_with_everyone}; + +mod popdat; +mod trips; diff --git a/map_editor/src/main.rs b/map_editor/src/main.rs index c9d7aca39a..267d010121 100644 --- a/map_editor/src/main.rs +++ b/map_editor/src/main.rs @@ -1,6 +1,3 @@ -mod model; -mod world; - use abstutil::{CmdArgs, Timer}; use geom::{Distance, Line, Polygon}; use map_model::osm; @@ -11,6 +8,9 @@ use widgetry::{ Outcome, Panel, ScreenPt, Text, VerticalAlignment, Widget, GUI, }; +mod model; +mod world; + struct UI { model: Model, state: State, diff --git a/map_model/src/edits/mod.rs b/map_model/src/edits/mod.rs index 3150c79bf1..d042379634 100644 --- a/map_model/src/edits/mod.rs +++ b/map_model/src/edits/mod.rs @@ -2,9 +2,6 @@ // the changes to a file (as PermanentMapEdits). See // https://dabreegster.github.io/abstreet/map/edits.html. -mod compat; -mod perma; - use crate::make::initial::lane_specs::get_lane_specs_ltr; use crate::{ connectivity, AccessRestrictions, BusRouteID, ControlStopSign, ControlTrafficSignal, Direction, @@ -17,6 +14,9 @@ pub use perma::PermanentMapEdits; use serde::{Deserialize, Serialize}; use std::collections::{BTreeMap, BTreeSet}; +mod compat; +mod perma; + // Represents changes to a map. Note this isn't serializable -- that's what PermanentMapEdits does. #[derive(Debug, Clone, PartialEq)] pub struct MapEdits { diff --git a/map_model/src/lib.rs b/map_model/src/lib.rs index 503c0f2212..f57aab6f51 100644 --- a/map_model/src/lib.rs +++ b/map_model/src/lib.rs @@ -21,17 +21,6 @@ // - t = turn // - ts = traffic signal -mod city; -pub mod connectivity; -mod edits; -mod make; -mod map; -mod objects; -pub mod osm; -mod pathfind; -pub mod raw; -mod traversable; - #[macro_use] extern crate log; @@ -66,6 +55,17 @@ use geom::{Bounds, Distance, GPSBounds, Polygon}; use serde::{Deserialize, Serialize}; use std::collections::BTreeMap; +mod city; +pub mod connectivity; +mod edits; +mod make; +mod map; +mod objects; +pub mod osm; +mod pathfind; +pub mod raw; +mod traversable; + // TODO Minimize uses of these! pub const NORMAL_LANE_THICKNESS: Distance = Distance::const_meters(2.5); pub(crate) const SERVICE_ROAD_LANE_THICKNESS: Distance = Distance::const_meters(1.5); diff --git a/map_model/src/make/initial/mod.rs b/map_model/src/make/initial/mod.rs index ee8cf017e7..3b108ff09a 100644 --- a/map_model/src/make/initial/mod.rs +++ b/map_model/src/make/initial/mod.rs @@ -1,9 +1,6 @@ // Naming is confusing, but RawMap -> InitialMap -> Map. InitialMap is separate pretty much just // for the step of producing https://dabreegster.github.io/abstreet/map/importing/geometry.html. -mod geometry; -pub mod lane_specs; - pub use self::geometry::intersection_polygon; use crate::raw::{OriginalRoad, RawMap, RawRoad}; use crate::{osm, DrivingSide, IntersectionType}; @@ -12,6 +9,9 @@ use geom::{Bounds, Circle, Distance, PolyLine, Polygon, Pt2D}; use lane_specs::LaneSpec; use std::collections::{BTreeMap, BTreeSet}; +mod geometry; +pub mod lane_specs; + pub struct InitialMap { pub roads: BTreeMap, pub intersections: BTreeMap, diff --git a/map_model/src/make/mod.rs b/map_model/src/make/mod.rs index 12aac01681..147fa74ade 100644 --- a/map_model/src/make/mod.rs +++ b/map_model/src/make/mod.rs @@ -1,16 +1,6 @@ // See https://dabreegster.github.io/abstreet/map/importing/index.html for an overview. This module // covers the RawMap->Map stage. -mod bridges; -mod buildings; -pub mod initial; -mod parking_lots; -mod remove_disconnected; -pub mod traffic_signals; -mod transit; -pub mod turns; -mod walking_turns; - use crate::pathfind::Pathfinder; use crate::raw::{OriginalRoad, RawMap}; use crate::{ @@ -22,6 +12,16 @@ use abstutil::{Parallelism, Timer}; use geom::{Bounds, Distance, FindClosest, HashablePt2D, Speed, EPSILON_DIST}; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; +mod bridges; +mod buildings; +pub mod initial; +mod parking_lots; +mod remove_disconnected; +pub mod traffic_signals; +mod transit; +pub mod turns; +mod walking_turns; + impl Map { pub fn create_from_raw(mut raw: RawMap, build_ch: bool, timer: &mut Timer) -> Map { // Better to defer this and see RawMaps with more debug info in map_editor diff --git a/map_model/src/pathfind/mod.rs b/map_model/src/pathfind/mod.rs index 030b0e7702..9f64cd6443 100644 --- a/map_model/src/pathfind/mod.rs +++ b/map_model/src/pathfind/mod.rs @@ -1,13 +1,5 @@ // Everything related to pathfinding through a map for different types of agents. -mod ch; -mod dijkstra; -mod driving; -mod node_map; -// TODO tmp -pub mod uber_turns; -mod walking; - pub use self::ch::ContractionHierarchyPathfinder; pub use self::driving::driving_cost; pub use self::walking::{walking_cost, WalkingNode}; @@ -22,6 +14,14 @@ use serde::{Deserialize, Serialize}; use std::collections::{BTreeSet, VecDeque}; use std::fmt; +mod ch; +mod dijkstra; +mod driving; +mod node_map; +// TODO tmp +pub mod uber_turns; +mod walking; + #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum PathStep { // Original direction diff --git a/sim/src/lib.rs b/sim/src/lib.rs index 2bcf5c35d4..a2bce766a7 100644 --- a/sim/src/lib.rs +++ b/sim/src/lib.rs @@ -1,16 +1,3 @@ -mod analytics; -mod cap; -mod events; -mod make; -mod mechanics; -mod pandemic; -mod render; -mod router; -mod scheduler; -mod sim; -mod transit; -mod trips; - #[macro_use] extern crate log; @@ -47,6 +34,19 @@ use map_model::{ use serde::{Deserialize, Serialize}; use std::fmt; +mod analytics; +mod cap; +mod events; +mod make; +mod mechanics; +mod pandemic; +mod render; +mod router; +mod scheduler; +mod sim; +mod transit; +mod trips; + // http://pccsc.net/bicycle-parking-info/ says 68 inches, which is 1.73m pub const BIKE_LENGTH: Distance = Distance::const_meters(1.8); // These two must be < PARKING_SPOT_LENGTH diff --git a/sim/src/make/mod.rs b/sim/src/make/mod.rs index af5f8cf3ab..b6fd447d65 100644 --- a/sim/src/make/mod.rs +++ b/sim/src/make/mod.rs @@ -1,10 +1,5 @@ -mod activity_model; -mod external; -mod generator; -mod load; -mod modifier; -mod scenario; -mod spawner; +use rand::{RngCore, SeedableRng}; +use rand_xorshift::XorShiftRng; pub use self::external::{ExternalPerson, ExternalTrip}; pub use self::generator::{ @@ -16,8 +11,14 @@ pub use self::scenario::{ IndividTrip, OffMapLocation, PersonSpec, Scenario, SpawnTrip, TripPurpose, }; pub use self::spawner::{TripSpawner, TripSpec}; -use rand::{RngCore, SeedableRng}; -use rand_xorshift::XorShiftRng; + +mod activity_model; +mod external; +mod generator; +mod load; +mod modifier; +mod scenario; +mod spawner; // Need to explain this trick -- basically keeps consistency between two different simulations when // each one might make slightly different sequences of calls to the RNG. diff --git a/sim/src/mechanics/mod.rs b/sim/src/mechanics/mod.rs index 78c508cf15..a337c48320 100644 --- a/sim/src/mechanics/mod.rs +++ b/sim/src/mechanics/mod.rs @@ -1,12 +1,12 @@ +pub use self::driving::DrivingSimState; +pub use self::intersection::IntersectionSimState; +pub use self::parking::{ParkingSim, ParkingSimState}; +pub use self::queue::Queue; +pub use self::walking::WalkingSimState; + mod car; mod driving; mod intersection; mod parking; mod queue; mod walking; - -pub use self::driving::DrivingSimState; -pub use self::intersection::IntersectionSimState; -pub use self::parking::{ParkingSim, ParkingSimState}; -pub use self::queue::Queue; -pub use self::walking::WalkingSimState; diff --git a/sim/src/pandemic/mod.rs b/sim/src/pandemic/mod.rs index a016d175cd..6f41aee45d 100644 --- a/sim/src/pandemic/mod.rs +++ b/sim/src/pandemic/mod.rs @@ -1,5 +1,3 @@ -mod pandemic; - use geom::{Duration, Time}; pub use pandemic::{Cmd, PandemicModel}; use rand::Rng; @@ -7,6 +5,8 @@ use rand_distr::{Distribution, Exp, Normal}; use rand_xorshift::XorShiftRng; use std::ops; +mod pandemic; + #[derive(Clone, Copy, Debug, PartialEq, PartialOrd)] pub struct AnyTime(f64); diff --git a/sim/src/sim/mod.rs b/sim/src/sim/mod.rs index e6fd9caded..db25efb196 100644 --- a/sim/src/sim/mod.rs +++ b/sim/src/sim/mod.rs @@ -1,5 +1,3 @@ -mod queries; - pub use self::queries::AgentProperties; use crate::{ AgentID, AlertLocation, Analytics, CapSimState, CarID, Command, CreateCar, DrawCarInput, @@ -23,6 +21,8 @@ use serde::{Deserialize, Serialize}; use std::collections::{BTreeSet, HashSet}; use std::panic; +mod queries; + // TODO Do something else. const BLIND_RETRY_TO_SPAWN: Duration = Duration::const_seconds(5.0); diff --git a/widgetry/src/lib.rs b/widgetry/src/lib.rs index 95164c53f5..9c6b2ca414 100644 --- a/widgetry/src/lib.rs +++ b/widgetry/src/lib.rs @@ -28,33 +28,6 @@ #[macro_use] extern crate log; -mod assets; -#[cfg(any(feature = "glow-backend", feature = "wasm-backend"))] -mod backend_glow; -#[cfg(feature = "glow-backend")] -mod backend_glow_native; -#[cfg(feature = "wasm-backend")] -mod backend_glow_wasm; -mod canvas; -mod color; -mod drawing; -mod event; -mod event_ctx; -mod geom; -mod input; -mod runner; -mod screen_geom; -mod style; -mod svg; -mod text; -mod tools; -mod widgets; - -mod backend { - #[cfg(any(feature = "glow-backend", feature = "wasm-backend"))] - pub use crate::backend_glow::*; -} - pub use crate::backend::Drawable; pub use crate::canvas::{Canvas, HorizontalAlignment, VerticalAlignment}; pub use crate::color::{Color, Fill, LinearGradient, Texture}; @@ -87,6 +60,33 @@ pub use crate::widgets::spinner::Spinner; pub(crate) use crate::widgets::text_box::TextBox; pub use crate::widgets::{EdgeInsets, Outcome, Panel, Widget, WidgetImpl, WidgetOutput}; +mod assets; +#[cfg(any(feature = "glow-backend", feature = "wasm-backend"))] +mod backend_glow; +#[cfg(feature = "glow-backend")] +mod backend_glow_native; +#[cfg(feature = "wasm-backend")] +mod backend_glow_wasm; +mod canvas; +mod color; +mod drawing; +mod event; +mod event_ctx; +mod geom; +mod input; +mod runner; +mod screen_geom; +mod style; +mod svg; +mod text; +mod tools; +mod widgets; + +mod backend { + #[cfg(any(feature = "glow-backend", feature = "wasm-backend"))] + pub use crate::backend_glow::*; +} + pub struct Choice { pub label: String, pub data: T, diff --git a/widgetry/src/widgets/mod.rs b/widgetry/src/widgets/mod.rs index 5240a265f8..c5e5411681 100644 --- a/widgetry/src/widgets/mod.rs +++ b/widgetry/src/widgets/mod.rs @@ -1,3 +1,18 @@ +use crate::widgets::containers::{Container, Nothing}; +pub use crate::widgets::panel::Panel; +use crate::{ + Button, Choice, Color, DeferDraw, DrawWithTooltips, Drawable, Dropdown, EventCtx, GeomBatch, + GfxCtx, JustDraw, Menu, RewriteColor, ScreenDims, ScreenPt, ScreenRectangle, Text, TextBox, +}; +use geom::{Distance, Percent, Polygon}; +use std::collections::HashSet; +use stretch::geometry::{Rect, Size}; +use stretch::node::{Node, Stretch}; +use stretch::number::Number; +use stretch::style::{ + AlignItems, Dimension, FlexDirection, FlexWrap, JustifyContent, PositionType, Style, +}; + pub mod autocomplete; pub mod button; pub mod checkbox; @@ -16,21 +31,6 @@ pub mod slider; pub mod spinner; pub mod text_box; -use crate::widgets::containers::{Container, Nothing}; -pub use crate::widgets::panel::Panel; -use crate::{ - Button, Choice, Color, DeferDraw, DrawWithTooltips, Drawable, Dropdown, EventCtx, GeomBatch, - GfxCtx, JustDraw, Menu, RewriteColor, ScreenDims, ScreenPt, ScreenRectangle, Text, TextBox, -}; -use geom::{Distance, Percent, Polygon}; -use std::collections::HashSet; -use stretch::geometry::{Rect, Size}; -use stretch::node::{Node, Stretch}; -use stretch::number::Number; -use stretch::style::{ - AlignItems, Dimension, FlexDirection, FlexWrap, JustifyContent, PositionType, Style, -}; - /// Create a new widget by implementing this trait. You can instantiate your widget by calling /// `Widget::new(Box::new(instance of your new widget))`, which gives you the usual style options. pub trait WidgetImpl: downcast_rs::Downcast {