<linkrel="alternate icon"type="image/png"href="../favicon-32x32.png"><styletype="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><bodyclass="rustdoc enum"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="sidebar"><divclass="sidebar-menu">☰</div><ahref='../widgetry/index.html'><divclass='logo-container rust-logo'><imgsrc='../rust-logo.png'alt='logo'></div></a><pclass="location">Enum Transition</p><divclass="sidebar-elems"><divclass="block items"><aclass="sidebar-title"href="#variants">Variants</a><divclass="sidebar-links"><ahref="#variant.Clear">Clear</a><ahref="#variant.Keep">Keep</a><ahref="#variant.KeepWithMouseover">KeepWithMouseover</a><ahref="#variant.ModifyState">ModifyState</a><ahref="#variant.Multi">Multi</a><ahref="#variant.Pop">Pop</a><ahref="#variant.Push">Push</a><ahref="#variant.Replace">Replace</a><ahref="#variant.ReplaceWithData">ReplaceWithData</a></div><aclass="sidebar-title"href="#synthetic-implementations">Auto Trait Implementations</a><divclass="sidebar-links"><ahref="#impl-RefUnwindSafe">!RefUnwindSafe</a><ahref="#impl-Send">!Send</a><ahref="#impl-Sync">!Sync</a><ahref="#impl-Unpin">Unpin</a><ahref="#impl-UnwindSafe">!UnwindSafe</a></div><aclass="sidebar-title"href="#blanket-implementations">Blanket Implementations</a><divclass="sidebar-links"><ahref="#impl-Any">Any</a><ahref="#impl-Borrow%3CT%3E">Borrow<T></a><ahref="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><ahref="#impl-Downcast">Downcast</a><ahref="#impl-From%3CT%3E">From<T></a><ahref="#impl-Into%3CU%3E">Into<U></a><ahref="#impl-Same%3CT%3E">Same<T></a><ahref="#impl-TryFrom%3CU%3E">TryFrom<U></a><ahref="#impl-TryInto%3CU%3E">TryInto<U></a></div></div><pclass="location"><ahref="index.html">widgetry</a></p><script>window.sidebarCurrent={name:"Transition",ty:"enum",relpath:""};</script><scriptdefersrc="sidebar-items.js"></script></div></nav><divclass="theme-picker"><buttonid="theme-picker"aria-label="Pick another theme!"aria-haspopup="menu"><imgsrc="../brush.svg"width="18"alt="Pick another theme!"></button><divid="theme-choices"role="menu"></div></div><scriptsrc="../theme.js"></script><navclass="sub"><formclass="search-form"><divclass="search-container"><div><selectid="crate-search"><optionvalue="All crates">All crates</option></select><inputclass="search-input"name="search"disabledautocomplete="off"spellcheck="false"placeholder="Click or press ‘S’ to search, ‘?’ for more options…"type="search"></div><buttontype="button"class="help-button">?</button>
<divid="variant.Keep"class="variant small-section-header"><ahref="#variant.Keep"class="anchor field"></a><code>Keep</code></div><divclass="docblock"><p>Don't do anything, keep the current state as the active one</p>
</div><divid="variant.KeepWithMouseover"class="variant small-section-header"><ahref="#variant.KeepWithMouseover"class="anchor field"></a><code>KeepWithMouseover</code></div><divclass="docblock"><p>Keep the current state as the active one, but immediately call <code>event</code> again with a mouse
</div><divid="variant.Pop"class="variant small-section-header"><ahref="#variant.Pop"class="anchor field"></a><code>Pop</code></div><divclass="docblock"><p>Destroy the current state, and resume from the previous one</p>
</div><divid="variant.ModifyState"class="variant small-section-header"><ahref="#variant.ModifyState"class="anchor field"></a><code>ModifyState(<aclass="struct"href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html"title="struct alloc::boxed::Box">Box</a><dyn <aclass="trait"href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>(&mut <aclass="struct"href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html"title="struct alloc::boxed::Box">Box</a><dyn <aclass="trait"href="../widgetry/app_state/trait.State.html"title="trait widgetry::app_state::State">State</a><A>>, &mut <aclass="struct"href="../widgetry/event_ctx/struct.EventCtx.html"title="struct widgetry::event_ctx::EventCtx">EventCtx</a><'_>, <aclass="primitive"href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>A)>)</code></div><divclass="docblock"><p>If a state needs to pass data back to its parent, use this. In the callback, you have to
</div><divid="variant.ReplaceWithData"class="variant small-section-header"><ahref="#variant.ReplaceWithData"class="anchor field"></a><code>ReplaceWithData(<aclass="struct"href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html"title="struct alloc::boxed::Box">Box</a><dyn <aclass="trait"href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnOnce.html"title="trait core::ops::function::FnOnce">FnOnce</a>(<aclass="struct"href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html"title="struct alloc::boxed::Box">Box</a><dyn <aclass="trait"href="../widgetry/app_state/trait.State.html"title="trait widgetry::app_state::State">State</a><A>>, &mut <aclass="struct"href="../widgetry/event_ctx/struct.EventCtx.html"title="struct widgetry::event_ctx::EventCtx">EventCtx</a><'_>, <aclass="primitive"href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>A) -><aclass="struct"href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html"title="struct alloc::vec::Vec">Vec</a><<aclass="struct"href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html"title="struct alloc::boxed::Box">Box</a><dyn <aclass="trait"href="../widgetry/app_state/trait.State.html"title="trait widgetry::app_state::State">State</a><A>>>>)</code></div><divid="variant.Push"class="variant small-section-header"><ahref="#variant.Push"class="anchor field"></a><code>Push(<aclass="struct"href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html"title="struct alloc::boxed::Box">Box</a><dyn <aclass="trait"href="../widgetry/app_state/trait.State.html"title="trait widgetry::app_state::State">State</a><A>>)</code></div><divclass="docblock"><p>Push a new active state on the top of the stack.</p>
</div><divid="variant.Replace"class="variant small-section-header"><ahref="#variant.Replace"class="anchor field"></a><code>Replace(<aclass="struct"href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html"title="struct alloc::boxed::Box">Box</a><dyn <aclass="trait"href="../widgetry/app_state/trait.State.html"title="trait widgetry::app_state::State">State</a><A>>)</code></div><divclass="docblock"><p>Replace the current state with a new one. Equivalent to Pop, then Push.</p>
</div><divid="variant.Clear"class="variant small-section-header"><ahref="#variant.Clear"class="anchor field"></a><code>Clear(<aclass="struct"href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html"title="struct alloc::vec::Vec">Vec</a><<aclass="struct"href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html"title="struct alloc::boxed::Box">Box</a><dyn <aclass="trait"href="../widgetry/app_state/trait.State.html"title="trait widgetry::app_state::State">State</a><A>>>)</code></div><divclass="docblock"><p>Replace the entire stack of states with this stack.</p>
</div><divid="variant.Multi"class="variant small-section-header"><ahref="#variant.Multi"class="anchor field"></a><code>Multi(<aclass="struct"href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html"title="struct alloc::vec::Vec">Vec</a><<aclass="enum"href="../widgetry/app_state/enum.Transition.html"title="enum widgetry::app_state::Transition">Transition</a><A>>)</code></div><divclass="docblock"><p>Execute a sequence of transitions in order.</p>
</div><h2id="synthetic-implementations"class="small-section-header">Auto Trait Implementations<ahref="#synthetic-implementations"class="anchor"></a></h2><divid="synthetic-implementations-list"><h3id="impl-RefUnwindSafe"class="impl"><codeclass="in-band">impl<A> !<aclass="trait"href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html"title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <aclass="enum"href="../widgetry/app_state/enum.Transition.html"title="enum widgetry::app_state::Transition">Transition</a><A></code><ahref="#impl-RefUnwindSafe"class="anchor"></a><aclass="srclink"href="../src/widgetry/lib.rs.html#1"title="goto source code">[src]</a></h3><divclass="impl-items"></div><h3id="impl-Send"class="impl"><codeclass="in-band">impl<A> !<aclass="trait"href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html"title="trait core::marker::Send">Send</a> for <aclass="enum"href="../widgetry/app_state/enum.Transition.html"title="enum widgetry::app_state::Transition">Transition</a><A></code><ahref="#impl-Send"class="anchor"></a><aclass="srclink"href="../src/widgetry/lib.rs.html#1"title="goto source code">[src]</a></h3><divclass="impl-items"></div><h3id="impl-Sync"class="impl"><codeclass="in-band">impl<A> !<aclass="trait"href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html"title="trait core::marker::Sync">Sync</a> for <aclass="enum"href="../widgetry/app_state/enum.Transition.html"title="enum widgetry::app_state::Transition">Transition</a><A></code><ahref="#impl-Sync"class="anchor"></a><aclass="srclink"href="../src/widgetry/lib.rs.html#1"title="goto source code">[src]</a></h3><divclass="impl-items"></div><h3id="impl-Unpin"class="impl"><codeclass="in-band">impl<A><aclass="trait"href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html"title="trait core::marker::Unpin">Unpin</a> for <aclass="enum"href="../widgetry/app_state/enum.Transition.html"title="enum widgetry::app_state::Transition">Transition</a><A></code><ahref="#impl-Unpin"class="anchor"></a><aclass="srclink"href="../src/widgetry/lib.rs.html#1"title="goto source code">[src]</a></h3><divclass="impl-items"></div><h3id="impl-UnwindSafe"class="impl"><codeclass="in-band">impl<A> !<aclass="trait"href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html"title="trait std::panic::UnwindSafe">UnwindSafe</a> for <aclass="enum"href="../widgetry/app_state/enum.Transition.html"title="enum widgetry::app_state::Transition">Transition</a><A></code><ahref="#impl-UnwindSafe"class="anchor"></a><aclass="srclink"href="../src/widgetry/lib.rs.html#1"title="goto source code">[src]</a></h3><divclass="impl-items"></div></div><h2id="blanket-implementations"class="small-section-header">Blanket Implementations<ahref="#blanket-implementations"class="anchor"></a></h2><divid="blanket-implementations-list"><h3id="impl-Any"class="impl"><codeclass="in-band">impl<T><aclass="trait"href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html"title="trait core::any::Any">Any</a> for T <spanclass="where fmt-newline">where<br> T: 'static + ?<aclass="trait"href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html"title="trait core::marker::Sized">Sized</a>, </span></code><ahref="#impl-Any"class="anchor"></a><aclass="srclink"href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#108-112"title="goto source code">[src]</a></h3><divclass="impl-items"><h4id="method.type_id"class="method hidden"><code>pub fn <ahref="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id"class="fnname">type_id</a>(&self) -><aclass="struct"href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html"title="struct core::any::TypeId">TypeId</a></code><aclass="srclink"href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#109-111"title="goto source code">[src]</a></h4><divclass='docblock hidden'><p>Gets
then be further <code>downcast</code> into <code>Box<ConcreteType></code> where <code>ConcreteType</code> implements <code>Trait</code>. <ahref="#tymethod.into_any">Read more</a></p>
further <code>downcast</code> into <code>Rc<ConcreteType></code> where <code>ConcreteType</code> implements <code>Trait</code>. <ahref="#tymethod.into_any_rc">Read more</a></p>
</div></div><h3id="impl-From%3CT%3E"class="impl"><codeclass="in-band">impl<T><aclass="trait"href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html"title="trait core::convert::From">From</a><T> for T</code><ahref="#impl-From%3CT%3E"class="anchor"></a><aclass="srclink"href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#552-556"title="goto source code">[src]</a></h3><divclass="impl-items"><h4id="method.from"class="method hidden"><code>pub fn <ahref="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from"class="fnname">from</a>(t: T) -> T</code><aclass="srclink"href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#553-555"title="goto source code">[src]</a></h4><divclass='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3id="impl-Into%3CU%3E"class="impl"><codeclass="in-band">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><U> for T <spanclass="where fmt-newline">where<br> U: <aclass="trait"href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html"title="trait core::convert::From">From</a><T>, </span></code><ahref="#impl-Into%3CU%3E"class="anchor"></a><aclass="srclink"href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#541-548"title="goto source code">[src]</a></h3><divclass="impl-items"><h4id="method.into"class="method hidden"><code>pub fn <ahref="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into"class="fnname">into</a>(self) -> U</code><aclass="srclink"href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#545-547"title="goto source code">[src]</a></h4><divclass='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3id="impl-Same%3CT%3E"class="impl"><codeclass="in-band">impl<T> Same<T> for T</code><ahref="#impl-Same%3CT%3E"class="anchor"></a></h3><divclass="impl-items"><h4id="associatedtype.Output"class="type"><code>type <ahref="#associatedtype.Output"class="type">Output</a> = T</code></h4><divclass='docblock'><p>Should always be <code>Self</code></p>
</div></div><h3id="impl-TryFrom%3CU%3E"class="impl"><codeclass="in-band">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U> for T <spanclass="where fmt-newline">where<br> U: <aclass="trait"href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><T>, </span></code><ahref="#impl-TryFrom%3CU%3E"class="anchor"></a><aclass="srclink"href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#589-598"title="goto source code">[src]</a></h3><divclass="impl-items"><h4id="associatedtype.Error"class="type"><code>type <ahref="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error"class="type">Error</a> = <aclass="enum"href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html"title="enum core::convert::Infallible">Infallible</a></code></h4><divclass='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4id="method.try_from"class="method hidden"><code>pub fn <ahref="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from"class="fnname">try_from</a>(value: U) -><aclass="enum"href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"title="enum core::result::Result">Result</a><T, <T as <aclass="trait"href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U>>::<aclass="type"href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></code><aclass="srclink"href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#595-597"title="goto source code">[src]</a></h4><divclass='docblock hidden'><p>Performs the conversion.</p>
</div></div><h3id="impl-TryInto%3CU%3E"class="impl"><codeclass="in-band">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html"title="trait core::convert::TryInto">TryInto</a><U> for T <spanclass="where fmt-newline">where<br> U: <aclass="trait"href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>, </span></code><ahref="#impl-TryInto%3CU%3E"class="anchor"></a><aclass="srclink"href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#575-584"title="goto source code">[src]</a></h3><divclass="impl-items"><h4id="associatedtype.Error-1"class="type"><code>type <ahref="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error"class="type">Error</a> = <U as <aclass="trait"href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="type"href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a></code></h4><divclass='docblock'><p>The type returned in the event of a conversion error.</p>
</div><h4id="method.try_into"class="method hidden"><code>pub fn <ahref="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into"class="fnname">try_into</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html"title="enum core::result::Result">Result</a><U, <U as <aclass="trait"href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="type"href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></code><aclass="srclink"href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#581-583"title="goto source code">[src]</a></h4><divclass='docblock hidden'><p>Performs the conversion.</p>