mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-25 23:43:25 +03:00
deploy: ead7960112
This commit is contained in:
parent
4ca74eab18
commit
7019fdca81
File diff suppressed because one or more lines are too long
@ -1,3 +1,3 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `native_loader` mod in crate `game`."><meta name="keywords" content="rust, rustlang, rust-lang, native_loader"><title>game::load::native_loader - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../../ayu.css" disabled ><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../../game/index.html'><div class='logo-container rust-logo'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Module native_loader</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><p class='location'><a href='../../index.html'>game</a>::<wbr><a href='../index.html'>load</a></p><script>window.sidebarCurrent = {name: 'native_loader', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><span class="help-button">?</span>
|
||||
<a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../../../src/game/load.rs.html#69-108' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../../index.html'>game</a>::<wbr><a href='../index.html'>load</a>::<wbr><a class="mod" href=''>native_loader</a></span></h1><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
|
||||
<a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../../../src/game/load.rs.html#69-106' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../../index.html'>game</a>::<wbr><a href='../index.html'>load</a>::<wbr><a class="mod" href=''>native_loader</a></span></h1><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
|
||||
<table><tr class='module-item'><td><a class="struct" href="struct.FileLoader.html" title='game::load::native_loader::FileLoader struct'>FileLoader</a></td><td class='docblock-short'></td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../../";window.currentCrate = "game";</script><script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,3 +1,3 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `BUILT_TIME_UTC` constant in crate `game`."><meta name="keywords" content="rust, rustlang, rust-lang, BUILT_TIME_UTC"><title>game::pregame::built_info::BUILT_TIME_UTC - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../../ayu.css" disabled ><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc constant"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../../game/index.html'><div class='logo-container rust-logo'><img src='../../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='../../index.html'>game</a>::<wbr><a href='../index.html'>pregame</a>::<wbr><a href='index.html'>built_info</a></p><script>window.sidebarCurrent = {name: 'BUILT_TIME_UTC', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><span class="help-button">?</span>
|
||||
<a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../../../src/game/home/runner/work/abstreet/abstreet/target/debug/build/game-e788b46a21eaee2a/out/built.rs.html#49' title='goto source code'>[src]</a></span><span class='in-band'>Constant <a href='../../index.html'>game</a>::<wbr><a href='../index.html'>pregame</a>::<wbr><a href='index.html'>built_info</a>::<wbr><a class="constant" href=''>BUILT_TIME_UTC</a></span></h1><pre class='rust const'>pub const BUILT_TIME_UTC: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = "Tue, 20 Oct 2020 23:55:31 +0000";</pre><div class='docblock'><p>The built-time in RFC2822, UTC</p>
|
||||
<a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../../../src/game/home/runner/work/abstreet/abstreet/target/debug/build/game-e788b46a21eaee2a/out/built.rs.html#49' title='goto source code'>[src]</a></span><span class='in-band'>Constant <a href='../../index.html'>game</a>::<wbr><a href='../index.html'>pregame</a>::<wbr><a href='index.html'>built_info</a>::<wbr><a class="constant" href=''>BUILT_TIME_UTC</a></span></h1><pre class='rust const'>pub const BUILT_TIME_UTC: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = "Wed, 21 Oct 2020 01:38:16 +0000";</pre><div class='docblock'><p>The built-time in RFC2822, UTC</p>
|
||||
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../../";window.currentCrate = "game";</script><script src="../../../main.js"></script><script defer src="../../../search-index.js"></script></body></html>
|
File diff suppressed because one or more lines are too long
@ -112,7 +112,7 @@
|
||||
<span class="doccomment">/// The output of `rustdoc -V`</span>
|
||||
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">RUSTDOC_VERSION</span>: <span class="kw-2">&</span><span class="ident">str</span> <span class="op">=</span> <span class="string">"rustdoc 1.47.0 (18bf6b4f0 2020-10-07)"</span>;
|
||||
<span class="doccomment">/// The built-time in RFC2822, UTC</span>
|
||||
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">BUILT_TIME_UTC</span>: <span class="kw-2">&</span><span class="ident">str</span> <span class="op">=</span> <span class="string">"Tue, 20 Oct 2020 23:55:31 +0000"</span>;
|
||||
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">BUILT_TIME_UTC</span>: <span class="kw-2">&</span><span class="ident">str</span> <span class="op">=</span> <span class="string">"Wed, 21 Oct 2020 01:38:16 +0000"</span>;
|
||||
<span class="doccomment">/// The target architecture, given by `cfg!(target_arch)`.</span>
|
||||
<span class="kw">pub</span> <span class="kw">const</span> <span class="ident">CFG_TARGET_ARCH</span>: <span class="kw-2">&</span><span class="ident">str</span> <span class="op">=</span> <span class="string">"x86_64"</span>;
|
||||
<span class="doccomment">/// The endianness, given by `cfg!(target_endian)`.</span>
|
||||
|
@ -226,6 +226,7 @@
|
||||
|
||||
<span class="kw">use</span> <span class="ident">serde</span>::<span class="ident">de</span>::<span class="ident">DeserializeOwned</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">abstutil</span>::<span class="ident">Timer</span>;
|
||||
<span class="kw">use</span> <span class="ident">sim</span>::<span class="ident">Sim</span>;
|
||||
<span class="kw">use</span> <span class="ident">widgetry</span>::{<span class="ident">Color</span>, <span class="ident">EventCtx</span>, <span class="ident">GfxCtx</span>};
|
||||
|
||||
@ -257,21 +258,20 @@
|
||||
<span class="ident">FileLoader</span>::<span class="op"><</span><span class="ident">map_model</span>::<span class="ident">Map</span><span class="op">></span>::<span class="ident">new</span>(
|
||||
<span class="ident">ctx</span>,
|
||||
<span class="ident">abstutil</span>::<span class="ident">path_map</span>(<span class="kw-2">&</span><span class="ident">name</span>),
|
||||
<span class="ident">Box</span>::<span class="ident">new</span>(<span class="kw">move</span> <span class="op">|</span><span class="ident">ctx</span>, <span class="ident">app</span>, <span class="ident">map</span><span class="op">|</span> {
|
||||
<span class="ident">Box</span>::<span class="ident">new</span>(<span class="kw">move</span> <span class="op">|</span><span class="ident">ctx</span>, <span class="ident">app</span>, <span class="ident">timer</span>, <span class="ident">map</span><span class="op">|</span> {
|
||||
<span class="comment">// TODO corrupt_err</span>
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">map</span> <span class="op">=</span> <span class="ident">map</span>.<span class="ident">unwrap</span>();
|
||||
|
||||
<span class="comment">// Kind of a hack. We can't generically call Map::new with the FileLoader.</span>
|
||||
<span class="ident">map</span>.<span class="ident">map_loaded_directly</span>();
|
||||
|
||||
<span class="ident">ctx</span>.<span class="ident">loading_screen</span>(<span class="string">"finish loading map"</span>, <span class="op">|</span><span class="ident">ctx</span>, <span class="ident">timer</span><span class="op">|</span> {
|
||||
<span class="kw">let</span> <span class="ident">sim</span> <span class="op">=</span> <span class="ident">Sim</span>::<span class="ident">new</span>(
|
||||
<span class="kw-2">&</span><span class="ident">map</span>,
|
||||
<span class="ident">app</span>.<span class="ident">primary</span>.<span class="ident">current_flags</span>.<span class="ident">sim_flags</span>.<span class="ident">opts</span>.<span class="ident">clone</span>(),
|
||||
<span class="ident">timer</span>,
|
||||
);
|
||||
<span class="ident">app</span>.<span class="ident">map_switched</span>(<span class="ident">ctx</span>, <span class="ident">map</span>, <span class="ident">sim</span>, <span class="ident">timer</span>);
|
||||
});
|
||||
<span class="kw">let</span> <span class="ident">sim</span> <span class="op">=</span> <span class="ident">Sim</span>::<span class="ident">new</span>(
|
||||
<span class="kw-2">&</span><span class="ident">map</span>,
|
||||
<span class="ident">app</span>.<span class="ident">primary</span>.<span class="ident">current_flags</span>.<span class="ident">sim_flags</span>.<span class="ident">opts</span>.<span class="ident">clone</span>(),
|
||||
<span class="ident">timer</span>,
|
||||
);
|
||||
<span class="ident">app</span>.<span class="ident">map_switched</span>(<span class="ident">ctx</span>, <span class="ident">map</span>, <span class="ident">sim</span>, <span class="ident">timer</span>);
|
||||
|
||||
(<span class="ident">on_load</span>)(<span class="ident">ctx</span>, <span class="ident">app</span>)
|
||||
}),
|
||||
)
|
||||
@ -296,14 +296,15 @@
|
||||
<span class="ident">path</span>: <span class="ident">String</span>,
|
||||
<span class="comment">// Wrapped in an Option just to make calling from event() work. Technically this is unsafe</span>
|
||||
<span class="comment">// if a caller fails to pop the FileLoader state in their transitions!</span>
|
||||
<span class="ident">on_load</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">FnOnce</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">EventCtx</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">App</span>, <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) <span class="op">-></span> <span class="ident">Transition</span><span class="op">>></span>,
|
||||
<span class="ident">on_load</span>:
|
||||
<span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">FnOnce</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">EventCtx</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">App</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Timer</span>, <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) <span class="op">-></span> <span class="ident">Transition</span><span class="op">>></span>,
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span>: <span class="lifetime">'static</span> <span class="op">+</span> <span class="ident">DeserializeOwned</span><span class="op">></span> <span class="ident">FileLoader</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(
|
||||
<span class="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">EventCtx</span>,
|
||||
<span class="ident">path</span>: <span class="ident">String</span>,
|
||||
<span class="ident">on_load</span>: <span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">FnOnce</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">EventCtx</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">App</span>, <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) <span class="op">-></span> <span class="ident">Transition</span><span class="op">></span>,
|
||||
<span class="ident">on_load</span>: <span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">FnOnce</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">EventCtx</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">App</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Timer</span>, <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) <span class="op">-></span> <span class="ident">Transition</span><span class="op">></span>,
|
||||
) <span class="op">-></span> <span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">State</span><span class="op">></span> {
|
||||
<span class="ident">Box</span>::<span class="ident">new</span>(<span class="ident">FileLoader</span> {
|
||||
<span class="ident">path</span>,
|
||||
@ -316,11 +317,8 @@
|
||||
<span class="kw">fn</span> <span class="ident">event</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">ctx</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">EventCtx</span>, <span class="ident">app</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">App</span>) <span class="op">-></span> <span class="ident">Transition</span> {
|
||||
<span class="ident">ctx</span>.<span class="ident">loading_screen</span>(<span class="macro">format</span><span class="macro">!</span>(<span class="string">"load {}"</span>, <span class="self">self</span>.<span class="ident">path</span>), <span class="op">|</span><span class="ident">ctx</span>, <span class="ident">timer</span><span class="op">|</span> {
|
||||
<span class="comment">// Assumes a binary file</span>
|
||||
(<span class="self">self</span>.<span class="ident">on_load</span>.<span class="ident">take</span>().<span class="ident">unwrap</span>())(
|
||||
<span class="ident">ctx</span>,
|
||||
<span class="ident">app</span>,
|
||||
<span class="ident">abstutil</span>::<span class="ident">maybe_read_binary</span>(<span class="self">self</span>.<span class="ident">path</span>.<span class="ident">clone</span>(), <span class="ident">timer</span>).<span class="ident">ok</span>(),
|
||||
)
|
||||
<span class="kw">let</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">abstutil</span>::<span class="ident">maybe_read_binary</span>(<span class="self">self</span>.<span class="ident">path</span>.<span class="ident">clone</span>(), <span class="ident">timer</span>).<span class="ident">ok</span>();
|
||||
(<span class="self">self</span>.<span class="ident">on_load</span>.<span class="ident">take</span>().<span class="ident">unwrap</span>())(<span class="ident">ctx</span>, <span class="ident">app</span>, <span class="ident">timer</span>, <span class="ident">file</span>)
|
||||
})
|
||||
}
|
||||
|
||||
@ -348,7 +346,8 @@
|
||||
<span class="comment">// compatible with winit's event loop.</span>
|
||||
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">FileLoader</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="ident">response</span>: <span class="ident">oneshot</span>::<span class="ident">Receiver</span><span class="op"><</span><span class="ident">Vec</span><span class="op"><</span><span class="ident">u8</span><span class="op">>></span>,
|
||||
<span class="ident">on_load</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">FnOnce</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">EventCtx</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">App</span>, <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) <span class="op">-></span> <span class="ident">Transition</span><span class="op">>></span>,
|
||||
<span class="ident">on_load</span>:
|
||||
<span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">FnOnce</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">EventCtx</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">App</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Timer</span>, <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) <span class="op">-></span> <span class="ident">Transition</span><span class="op">>></span>,
|
||||
<span class="ident">panel</span>: <span class="ident">Panel</span>,
|
||||
<span class="ident">started</span>: <span class="ident">Instant</span>,
|
||||
<span class="ident">url</span>: <span class="ident">String</span>,
|
||||
@ -358,7 +357,7 @@
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(
|
||||
<span class="ident">ctx</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">EventCtx</span>,
|
||||
<span class="ident">path</span>: <span class="ident">String</span>,
|
||||
<span class="ident">on_load</span>: <span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">FnOnce</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">EventCtx</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">App</span>, <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) <span class="op">-></span> <span class="ident">Transition</span><span class="op">></span>,
|
||||
<span class="ident">on_load</span>: <span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">FnOnce</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">EventCtx</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">App</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Timer</span>, <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) <span class="op">-></span> <span class="ident">Transition</span><span class="op">></span>,
|
||||
) <span class="op">-></span> <span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">State</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">url</span> <span class="op">=</span> <span class="kw">if</span> <span class="macro">cfg</span><span class="macro">!</span>(<span class="ident">feature</span> <span class="op">=</span> <span class="string">"wasm_s3"</span>) {
|
||||
<span class="macro">format</span><span class="macro">!</span>(
|
||||
@ -410,13 +409,14 @@
|
||||
<span class="comment">// while. Any way to make it still be nonblockingish? Maybe put some of the work</span>
|
||||
<span class="comment">// inside that spawn_local?</span>
|
||||
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">timer</span> <span class="op">=</span> <span class="ident">Timer</span>::<span class="ident">new</span>(<span class="macro">format</span><span class="macro">!</span>(<span class="string">"Loading {}..."</span>, <span class="self">self</span>.<span class="ident">url</span>));
|
||||
<span class="kw">match</span> <span class="ident">abstutil</span>::<span class="ident">from_binary</span>(<span class="kw-2">&</span><span class="ident">resp</span>) {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">obj</span>) <span class="op">=></span> {
|
||||
<span class="kw">return</span> (<span class="self">self</span>.<span class="ident">on_load</span>.<span class="ident">take</span>().<span class="ident">unwrap</span>())(<span class="ident">ctx</span>, <span class="ident">app</span>, <span class="prelude-val">Some</span>(<span class="ident">obj</span>));
|
||||
<span class="kw">return</span> (<span class="self">self</span>.<span class="ident">on_load</span>.<span class="ident">take</span>().<span class="ident">unwrap</span>())(<span class="ident">ctx</span>, <span class="ident">app</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">timer</span>, <span class="prelude-val">Some</span>(<span class="ident">obj</span>));
|
||||
}
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=></span> {
|
||||
<span class="macro">error</span><span class="macro">!</span>(<span class="string">"{}: {}"</span>, <span class="self">self</span>.<span class="ident">url</span>, <span class="ident">err</span>);
|
||||
<span class="kw">return</span> (<span class="self">self</span>.<span class="ident">on_load</span>.<span class="ident">take</span>().<span class="ident">unwrap</span>())(<span class="ident">ctx</span>, <span class="ident">app</span>, <span class="prelude-val">None</span>);
|
||||
<span class="kw">return</span> (<span class="self">self</span>.<span class="ident">on_load</span>.<span class="ident">take</span>().<span class="ident">unwrap</span>())(<span class="ident">ctx</span>, <span class="ident">app</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">timer</span>, <span class="prelude-val">None</span>);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1341,7 +1341,7 @@
|
||||
<span class="kw">return</span> <span class="ident">Transition</span>::<span class="ident">Push</span>(<span class="ident">FileLoader</span>::<span class="op"><</span><span class="ident">Scenario</span><span class="op">></span>::<span class="ident">new</span>(
|
||||
<span class="ident">ctx</span>,
|
||||
<span class="ident">path</span>,
|
||||
<span class="ident">Box</span>::<span class="ident">new</span>(<span class="op">|</span><span class="kw">_</span>, <span class="kw">_</span>, <span class="ident">scenario</span><span class="op">|</span> {
|
||||
<span class="ident">Box</span>::<span class="ident">new</span>(<span class="op">|</span><span class="kw">_</span>, <span class="kw">_</span>, <span class="kw">_</span>, <span class="ident">scenario</span><span class="op">|</span> {
|
||||
<span class="comment">// TODO Handle corrupt files</span>
|
||||
<span class="kw">let</span> <span class="ident">scenario</span> <span class="op">=</span> <span class="ident">scenario</span>.<span class="ident">unwrap</span>();
|
||||
<span class="ident">Transition</span>::<span class="ident">Multi</span>(<span class="macro">vec</span><span class="macro">!</span>[
|
||||
@ -1394,7 +1394,7 @@
|
||||
<span class="kw">return</span> <span class="ident">Transition</span>::<span class="ident">Push</span>(<span class="ident">FileLoader</span>::<span class="op"><</span><span class="ident">Analytics</span><span class="op">></span>::<span class="ident">new</span>(
|
||||
<span class="ident">ctx</span>,
|
||||
<span class="ident">abstutil</span>::<span class="ident">path_prebaked_results</span>(<span class="ident">app</span>.<span class="ident">primary</span>.<span class="ident">map</span>.<span class="ident">get_name</span>(), <span class="kw-2">&</span><span class="ident">scenario_name</span>),
|
||||
<span class="ident">Box</span>::<span class="ident">new</span>(<span class="kw">move</span> <span class="op">|</span><span class="kw">_</span>, <span class="kw">_</span>, <span class="ident">prebaked</span><span class="op">|</span> {
|
||||
<span class="ident">Box</span>::<span class="ident">new</span>(<span class="kw">move</span> <span class="op">|</span><span class="kw">_</span>, <span class="kw">_</span>, <span class="kw">_</span>, <span class="ident">prebaked</span><span class="op">|</span> {
|
||||
<span class="ident">Transition</span>::<span class="ident">Multi</span>(<span class="macro">vec</span><span class="macro">!</span>[
|
||||
<span class="ident">Transition</span>::<span class="ident">Pop</span>,
|
||||
<span class="ident">Transition</span>::<span class="ident">ModifyState</span>(<span class="ident">Box</span>::<span class="ident">new</span>(<span class="kw">move</span> <span class="op">|</span><span class="ident">state</span>, <span class="kw">_</span>, <span class="kw">_</span><span class="op">|</span> {
|
||||
|
@ -446,7 +446,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">LoadingScreen</span><span class="op"><</span><span class="lifetime">'a</span><span class="op">></span> {
|
||||
<span class="kw">struct</span> <span class="ident">LoadingScreen</span><span class="op"><</span><span class="lifetime">'a</span><span class="op">></span> {
|
||||
<span class="ident">canvas</span>: <span class="ident">Canvas</span>,
|
||||
<span class="ident">style</span>: <span class="ident">Style</span>,
|
||||
<span class="ident">prerender</span>: <span class="kw-2">&</span><span class="lifetime">'a</span> <span class="ident">Prerender</span>,
|
||||
@ -457,7 +457,7 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'a</span><span class="op">></span> <span class="ident">LoadingScreen</span><span class="op"><</span><span class="lifetime">'a</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(
|
||||
<span class="kw">fn</span> <span class="ident">new</span>(
|
||||
<span class="ident">prerender</span>: <span class="kw-2">&</span><span class="lifetime">'a</span> <span class="ident">Prerender</span>,
|
||||
<span class="ident">style</span>: <span class="ident">Style</span>,
|
||||
<span class="ident">initial_size</span>: <span class="ident">ScreenDims</span>,
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user