<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="API documentation for the Rust `ButtonBuilder` struct in crate `widgetry`."><metaname="keywords"content="rust, rustlang, rust-lang, ButtonBuilder"><title>ButtonBuilder in widgetry - Rust</title><linkrel="stylesheet"type="text/css"href="../normalize.css"><linkrel="stylesheet"type="text/css"href="../rustdoc.css"id="mainThemeStyle"><linkrel="stylesheet"type="text/css"href="../light.css"id="themeStyle"><linkrel="stylesheet"type="text/css"href="../dark.css"disabled><linkrel="stylesheet"type="text/css"href="../ayu.css"disabled><scriptid="default-settings"></script><scriptsrc="../storage.js"></script><scriptsrc="../crates.js"></script><scriptdefersrc="../main.js"></script>
<noscript><linkrel="stylesheet"href="../noscript.css"></noscript><linkrel="alternate icon"type="image/png"href="../favicon-16x16.png"><linkrel="alternate icon"type="image/png"href="../favicon-32x32.png"><linkrel="icon"type="image/svg+xml"href="../favicon.svg"><styletype="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><bodyclass="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="sidebar"><divclass="sidebar-menu"role="button">☰</div><ahref='../widgetry/index.html'><divclass='logo-container rust-logo'><imgsrc='../rust-logo.png'alt='logo'></div></a><h2class="location">Struct ButtonBuilder</h2><divclass="sidebar-elems"><divclass="block items"><h3class="sidebar-title"><ahref="#fields">Fields</a></h3><divclass="sidebar-links"><ahref="#structfield.corner_rounding">corner_rounding</a><ahref="#structfield.default_style">default_style</a><ahref="#structfield.disable_style">disable_style</a><ahref="#structfield.disabled_tooltip">disabled_tooltip</a><ahref="#structfield.hotkey">hotkey</a><ahref="#structfield.hover_style">hover_style</a><ahref="#structfield.is_disabled">is_disabled</a><ahref="#structfield.is_label_before_image">is_label_before_image</a><ahref="#structfield.padding">padding</a><ahref="#structfield.stack_axis">stack_axis</a><ahref="#structfield.stack_spacing">stack_spacing</a><ahref="#structfield.tooltip">tooltip</a></div><h3class="sidebar-title"><ahref="#implementations">Methods</a></h3><divclass="sidebar-links"><ahref="#method.batch">batch</a><ahref="#method.bg_color">bg_color</a><ahref="#method.build">build</a><ahref="#method.build_def">build_def</a><ahref="#method.build_widget">build_widget</a><ahref="#method.corner_rounding">corner_rounding</a><ahref="#method.custom_batch">custom_batch</a><ahref="#method.disabled">disabled</a><ahref="#method.disabled_tooltip">disabled_tooltip</a><ahref="#method.font">font</a><ahref="#method.font_size">font_size</a><ahref="#method.horizontal">horizontal</a><ahref="#method.hotkey">hotkey</a><ahref="#method.image">image</a><ahref="#method.image_batch">image_batch</a><ahref="#method.image_bg_color">image_bg_color</a><ahref="#method.image_bytes">image_bytes</a><ahref="#method.image_color">image_color</a><ahref="#method.image_content_mode">image_content_mode</a><ahref="#method.image_corner_rounding">image_corner_rounding</a><ahref="#method.image_dims">image_dims</a><ahref="#method.image_first">image_first</a><ahref="#method.image_padding">image_padding</a><ahref="#method.image_path">image_path</a><ahref="#method.label_color">label_color</a><ahref="#method.label_first">label_first</a><ahref="#method.label_styled_text">label_styled_text</a><ahref="#method.label_text">label_text</a><ahref="#method.label_underlined_text">label_underlined_text</a><ahref="#method.new">new</a><ahref="#method.no_tooltip">no_tooltip</a><ahref="#method.outline">outline</a><ahref="#method.outline_color">outline_color</a><ahref="#method.override_style">override_style</a><ahref="#method.padding">padding</a><ahref="#method.padding_bottom">padding_bottom</a><ahref="#method.padding_left">padding_left</a><ahref="#method.padding_right">padding_right</a><ahref="#method.padding_top">padding_top</a><ahref="#method.stack_spacing">stack_spacing</a><ahref="#method.style">style</a><ahref="#method.style_mut">style_mut</a><ahref="#method.tooltip">tooltip</a><ahref="#method.vertical">vertical</a></div><h3class="sidebar-title"><ahref="#trait-implementations">Trait Implementations</a></h3><divclass="sidebar-links"><ahref="#impl-Clone">Clone</a><ahref="#impl-Debug">Debug</a><ahref="#impl-Default">Default</a></div><h3class="sidebar-title"><ahref="#synthetic-implementations">Auto Trait Implementations</a></h3><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-UnwindSaf
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.padding_top"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#200-203"title="goto source code">[src]</a></div><ahref="#method.padding_top"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.padding_top"class="fnname">padding_top</a>(self, padding: <aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.f64.html">f64</a>) -> Self</h4></div></summary><divclass="docblock"><p>Extra spacing around a button’s items (label and/or image).</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.padding_left"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#206-209"title="goto source code">[src]</a></div><ahref="#method.padding_left"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.padding_left"class="fnname">padding_left</a>(self, padding: <aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.f64.html">f64</a>) -> Self</h4></div></summary><divclass="docblock"><p>Extra spacing around a button’s items (label and/or image).</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.padding_bottom"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#212-215"title="goto source code">[src]</a></div><ahref="#method.padding_bottom"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.padding_bottom"class="fnname">padding_bottom</a>(self, padding: <aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.f64.html">f64</a>) -> Self</h4></div></summary><divclass="docblock"><p>Extra spacing around a button’s items (label and/or image).</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.padding_right"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#218-221"title="goto source code">[src]</a></div><ahref="#method.padding_right"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.padding_right"class="fnname">padding_right</a>(self, padding: <aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.f64.html">f64</a>) -> Self</h4></div></summary><divclass="docblock"><p>Extra spacing around a button’s items (label and/or image).</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.label_text"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#226-231"title="goto source code">[src]</a></div><ahref="#method.label_text"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.label_text"class="fnname">label_text</a><I: <aclass="trait"href="https://doc.rust-lang.org/1.58.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><<aclass="struct"href="https://doc.rust-lang.org/1.58.0/alloc/string/struct.String.html"title="struct alloc::string::String">String</a>>>(self, text: I) -> Self</h4></div></summary><divclass="docblock"><p>Set the text of the button’s label.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.label_underlined_text"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#236-243"title="goto source code">[src]</a></div><ahref="#method.label_underlined_text"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.label_underlined_text"class="fnname">label_underlined_text</a><I: <aclass="trait"href="https://doc.rust-lang.org/1.58.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><<aclass="struct"href="https://doc.rust-lang.org/1.58.0/alloc/string/struct.String.html"title="struct alloc::string::String">String</a>>>(self, text: I) -> Self</h4></div></summary><divclass="docblock"><p>Set the text of the button’s label. The text will be decorated with an underline.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.label_styled_text"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#247-257"title="goto source code">[src]</a></div><ahref="#method.label_styled_text"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.label_styled_text"class="fnname">label_styled_text</a>(<br> self, <br> styled_text: <aclass="struct"href="text/struct.Text.html"title="struct widgetry::text::Text">Text</a>, <br> for_state: <aclass="enum"href="enum.ControlState.html"title="enum widgetry::ControlState">ControlState</a><br>) -> Self</h4></div></summary><divclass="docblock"><p>Assign a pre-styled <code>Text</code> instance if your button need something more than uniformly
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.font"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#273-278"title="goto source code">[src]</a></div><ahref="#method.font"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.font"class="fnname">font</a>(self, font: <aclass="enum"href="text/enum.Font.html"title="enum widgetry::text::Font">Font</a>) -> Self</h4></div></summary><divclass="docblock"><p>Set the font used by the button’s label.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.font_size"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#283-288"title="goto source code">[src]</a></div><ahref="#method.font_size"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.font_size"class="fnname">font_size</a>(self, font_size: <aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.usize.html">usize</a>) -> Self</h4></div></summary><divclass="docblock"><p>Set the size of the font of the button’s label.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.image_path"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#293-300"title="goto source code">[src]</a></div><ahref="#method.image_path"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.image_path"class="fnname">image_path</a>(self, path: &'a <aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.str.html">str</a>) -> Self</h4></div></summary><divclass="docblock"><p>Set the image for the button. If not set, the button will have no image.</p>
</div></details><divid="method.image"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#302-307"title="goto source code">[src]</a></div><ahref="#method.image"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.image"class="fnname">image</a>(self, image: <aclass="struct"href="widgets/image/struct.Image.html"title="struct widgetry::widgets::image::Image">Image</a><'a, 'c>) -> Self</h4></div><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.image_bytes"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#317-324"title="goto source code">[src]</a></div><ahref="#method.image_bytes"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.image_bytes"class="fnname">image_bytes</a>(self, labeled_bytes: <aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.tuple.html">(</a>&'a <aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.str.html">str</a>, <aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.slice.html">&'a [</a><aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.u8.html">u8</a><aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.slice.html">]</a><aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.tuple.html">)</a>) -> Self</h4></div></summary><divclass="docblock"><p>Set the image for the button. If not set, the button will have no image.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.image_batch"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#332-337"title="goto source code">[src]</a></div><ahref="#method.image_batch"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.image_batch"class="fnname">image_batch</a>(self, batch: <aclass="struct"href="geom/struct.GeomBatch.html"title="struct widgetry::geom::GeomBatch">GeomBatch</a>, bounds: <aclass="struct"href="../geom/bounds/struct.Bounds.html"title="struct geom::bounds::Bounds">Bounds</a>) -> Self</h4></div></summary><divclass="docblock"><p>Set the image for the button. If not set, the button will have no image.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.image_bg_color"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#359-365"title="goto source code">[src]</a></div><ahref="#method.image_bg_color"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.image_bg_color"class="fnname">image_bg_color</a>(self, color: <aclass="struct"href="color/struct.Color.html"title="struct widgetry::color::Color">Color</a>, for_state: <aclass="enum"href="enum.ControlState.html"title="enum widgetry::ControlState">ControlState</a>) -> Self</h4></div></summary><divclass="docblock"><p>Set a background color for the image, other than the buttons background.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.image_dims"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#372-377"title="goto source code">[src]</a></div><ahref="#method.image_dims"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.image_dims"class="fnname">image_dims</a><D: <aclass="trait"href="https://doc.rust-lang.org/1.58.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><<aclass="struct"href="screen_geom/struct.ScreenDims.html"title="struct widgetry::screen_geom::ScreenDims">ScreenDims</a>>>(self, dims: D) -> Self</h4></div></summary><divclass="docblock"><p>Scale the bounds containing the image. If <code>image_dims</code> are not specified, the images
<p>See <ahref="widgets/button/struct.ButtonBuilder.html#method.image_content_mode"title="ButtonBuilder::image_content_mode"><code>ButtonBuilder::image_content_mode</code></a> to control how the image scales to fit
</div></details><divid="method.override_style"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#379-381"title="goto source code">[src]</a></div><ahref="#method.override_style"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.override_style"class="fnname">override_style</a>(self, style: &<aclass="struct"href="style/button_style/struct.ButtonStyle.html"title="struct widgetry::style::button_style::ButtonStyle">ButtonStyle</a>) -> Self</h4></div><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.image_content_mode"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#390-395"title="goto source code">[src]</a></div><ahref="#method.image_content_mode"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.image_content_mode"class="fnname">image_content_mode</a>(self, content_mode: <aclass="enum"href="enum.ContentMode.html"title="enum widgetry::ContentMode">ContentMode</a>) -> Self</h4></div></summary><divclass="docblock"><p>If a custom <code>image_dims</code> was set, control how the image should be scaled to its new bounds</p>
<p>The default, <ahref="enum.ContentMode.html#variant.ScaleAspectFit"title="ContentMode::ScaleAspectFit"><code>ContentMode::ScaleAspectFit</code></a> will only grow as much as it can while
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.bg_color"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#417-420"title="goto source code">[src]</a></div><ahref="#method.bg_color"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.bg_color"class="fnname">bg_color</a>(self, color: <aclass="struct"href="color/struct.Color.html"title="struct widgetry::color::Color">Color</a>, for_state: <aclass="enum"href="enum.ControlState.html"title="enum widgetry::ControlState">ControlState</a>) -> Self</h4></div></summary><divclass="docblock"><p>Set a background color for the button based on the button’s <ahref="enum.ControlState.html"title="ControlState"><code>ControlState</code></a>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.outline"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#426-429"title="goto source code">[src]</a></div><ahref="#method.outline"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.outline"class="fnname">outline</a>(self, outline: <aclass="type"href="style/type.OutlineStyle.html"title="type widgetry::style::OutlineStyle">OutlineStyle</a>, for_state: <aclass="enum"href="enum.ControlState.html"title="enum widgetry::ControlState">ControlState</a>) -> Self</h4></div></summary><divclass="docblock"><p>Set an outline for the button based on the button’s <ahref="enum.ControlState.html"title="ControlState"><code>ControlState</code></a>.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.hotkey"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#453-456"title="goto source code">[src]</a></div><ahref="#method.hotkey"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.hotkey"class="fnname">hotkey</a><MK: <aclass="trait"href="https://doc.rust-lang.org/1.58.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><<aclass="enum"href="https://doc.rust-lang.org/1.58.0/core/option/enum.Option.html"title="enum core::option::Option">Option</a><<aclass="enum"href="event/enum.MultiKey.html"title="enum widgetry::event::MultiKey">MultiKey</a>>>>(self, key: MK) -> Self</h4></div></summary><divclass="docblock"><p>Set a hotkey for the button</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.tooltip"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#461-464"title="goto source code">[src]</a></div><ahref="#method.tooltip"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.tooltip"class="fnname">tooltip</a>(self, tooltip: impl <aclass="trait"href="https://doc.rust-lang.org/1.58.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><<aclass="struct"href="text/struct.Text.html"title="struct widgetry::text::Text">Text</a>>) -> Self</h4></div></summary><divclass="docblock"><p>Set a non-default tooltip <ahref="text/struct.Text.html"title="Text"><code>Text</code></a> to appear when hovering over the button.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.no_tooltip"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#468-472"title="goto source code">[src]</a></div><ahref="#method.no_tooltip"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.no_tooltip"class="fnname">no_tooltip</a>(self) -> Self</h4></div></summary><divclass="docblock"><p>If a <code>tooltip</code> is not specified, a default tooltip will be applied. Use <code>no_tooltip</code> when
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.disabled_tooltip"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#478-481"title="goto source code">[src]</a></div><ahref="#method.disabled_tooltip"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.disabled_tooltip"class="fnname">disabled_tooltip</a>(self, tooltip: impl <aclass="trait"href="https://doc.rust-lang.org/1.58.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><<aclass="struct"href="text/struct.Text.html"title="struct widgetry::text::Text">Text</a>>) -> Self</h4></div></summary><divclass="docblock"><p>Set a tooltip <ahref="text/struct.Text.html"title="Text"><code>Text</code></a> to appear when hovering over the button, when the button is
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.vertical"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#486-489"title="goto source code">[src]</a></div><ahref="#method.vertical"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.vertical"class="fnname">vertical</a>(self) -> Self</h4></div></summary><divclass="docblock"><p>The button’s items will be rendered in a vertical column</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.horizontal"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#494-497"title="goto source code">[src]</a></div><ahref="#method.horizontal"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.horizontal"class="fnname">horizontal</a>(self) -> Self</h4></div></summary><divclass="docblock"><p>The button’s items will be rendered in a horizontal row</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.disabled"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#500-503"title="goto source code">[src]</a></div><ahref="#method.disabled"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.disabled"class="fnname">disabled</a>(self, is_disabled: <aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.bool.html">bool</a>) -> Self</h4></div></summary><divclass="docblock"><p>The button cannot be clicked and will be styled as <ahref="enum.ControlState.html#variant.Disabled"title="ControlState::Disabled"><code>ControlState::Disabled</code></a></p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.stack_spacing"class="method has-srclink"><divclass="rightside"><aclass="srclink"href="../src/widgetry/widgets/button.rs.html#523-526"title="goto source code">[src]</a></div><ahref="#method.stack_spacing"class="anchor"></a><h4class="code-header">pub fn <ahref="#method.stack_spacing"class="fnname">stack_spacing</a>(self, value: <aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.f64.html">f64</a>) -> Self</h4></div></summary><divclass="docblock"><p>Spacing between the image and text of a button.
<spanclass="kw">let</span><spanclass="ident">red_button_1</span><spanclass="op">=</span><spanclass="ident">red_builder</span>.<spanclass="ident">clone</span>().<spanclass="ident">label_text</span>(<spanclass="string">"First red button"</span>).<spanclass="ident">build</span>(<spanclass="ident">ctx</span>, <spanclass="string">"first"</span>);
<spanclass="kw">let</span><spanclass="ident">red_button_2</span><spanclass="op">=</span><spanclass="ident">red_builder</span>.<spanclass="ident">clone</span>().<spanclass="ident">label_text</span>(<spanclass="string">"Second red button"</span>).<spanclass="ident">build</span>(<spanclass="ident">ctx</span>, <spanclass="string">"second"</span>);
<spanclass="kw">let</span><spanclass="ident">red_button_3</span><spanclass="op">=</span><spanclass="ident">red_builder</span>.<spanclass="ident">label_text</span>(<spanclass="string">"Last red button"</span>).<spanclass="ident">build</span>(<spanclass="ident">ctx</span>, <spanclass="string">"third"</span>);
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>
further <code>downcast</code> into <code>Arc<ConcreteType></code> where <code>ConcreteType</code> implements <code>Trait</code>. <ahref="#tymethod.into_any_arc">Read more</a></p>
</div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><divid="impl-ToOwned"class="impl has-srclink"><divclass="rightside"><aclass="srclink"href="https://doc.rust-lang.org/1.58.0/src/alloc/borrow.rs.html#84-96"title="goto source code">[src]</a></div><ahref="#impl-ToOwned"class="anchor"></a><h3class="code-header in-band">impl<T><aclass="trait"href="https://doc.rust-lang.org/1.58.0/alloc/borrow/trait.ToOwned.html"title="trait alloc::borrow::ToOwned">ToOwned</a> for T <spanclass="where fmt-newline">where<br> T: <aclass="trait"href="https://doc.rust-lang.org/1.58.0/core/clone/trait.Clone.html"title="trait core::clone::Clone">Clone</a>, </span></h3></div></summary><divclass="impl-items"><detailsclass="rustdoc-toggle"open><summary><divid="associatedtype.Owned"class="type trait-impl has-srclink"><ahref="#associatedtype.Owned"class="anchor"></a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.58.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned"class="type">Owned</a> = T</h4></div></summary><divclass='docblock'><p>The resulting type after obtaining ownership.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.to_owned"class="method trait-impl has-srclink"><divclass="rightside"><aclass="srclink"href="https://doc.rust-lang.org/1.58.0/src/alloc/borrow.rs.html#89"title="goto source code">[src]</a></div><ahref="#method.to_owned"class="anchor"></a><h4class="code-header">pub fn <ahref="https://doc.rust-lang.org/1.58.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned"class="fnname">to_owned</a>(&self) -> T</h4></div></summary><divclass='docblock'><p>Creates owned data from borrowed data, usually by cloning. <ahref="https://doc.rust-lang.org/1.58.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.clone_into"class="method trait-impl has-srclink"><divclass="rightside"><aclass="srclink"href="https://doc.rust-lang.org/1.58.0/src/alloc/borrow.rs.html#93"title="goto source code">[src]</a></div><ahref="#method.clone_into"class="anchor"></a><h4class="code-header">pub fn <ahref="https://doc.rust-lang.org/1.58.0/alloc/borrow/trait.ToOwned.html#method.clone_into"class="fnname">clone_into</a>(&self, target: <aclass="primitive"href="https://doc.rust-lang.org/1.58.0/std/primitive.reference.html">&mut </a>T)</h4></div></summary><divclass="item-info"><divclass="stab unstable"><spanclass="emoji">🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</div></div><divclass='docblock'><p>Uses borrowed data to replace owned data, usually by cloning. <ahref="https://doc.rust-lang.org/1.58.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
</div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><divid="impl-TryFrom%3CU%3E"class="impl has-srclink"><divclass="rightside"><aclass="srclink"href="https://doc.rust-lang.org/1.58.0/src/core/convert/mod.rs.html#587-596"title="goto source code">[src]</a></div><ahref="#impl-TryFrom%3CU%3E"class="anchor"></a><h3class="code-header in-band">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.58.0/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/1.58.0/core/convert/trait.Into.html"title="trait core::convert::Into">Into</a><T>, </span></h3></div></summary><divclass="impl-items"><detailsclass="rustdoc-toggle"open><summary><divid="associatedtype.Error"class="type trait-impl has-srclink"><ahref="#associatedtype.Error"class="anchor"></a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.58.0/core/convert/trait.TryFrom.html#associatedtype.Error"class="type">Error</a> = <aclass="enum"href="https://doc.rust-lang.org/1.58.0/core/convert/enum.Infallible.html"title="enum core::convert::Infallible">Infallible</a></h4></div></summary><divclass='docblock'><p>The type returned in the event of a conversion error.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.try_from"class="method trait-impl has-srclink"><divclass="rightside"><aclass="srclink"href="https://doc.rust-lang.org/1.58.0/src/core/convert/mod.rs.html#593"title="goto source code">[src]</a></div><ahref="#method.try_from"class="anchor"></a><h4class="code-header">pub fn <ahref="https://doc.rust-lang.org/1.58.0/core/convert/trait.TryFrom.html#tymethod.try_from"class="fnname">try_from</a>(value: U) -><aclass="enum"href="https://doc.rust-lang.org/1.58.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><T, <T as <aclass="trait"href="https://doc.rust-lang.org/1.58.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><U>>::<aclass="type"href="https://doc.rust-lang.org/1.58.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><divclass='docblock'><p>Performs the conversion.</p>
</div></details></div></details><detailsclass="rustdoc-toggle implementors-toggle"open><summary><divid="impl-TryInto%3CU%3E"class="impl has-srclink"><divclass="rightside"><aclass="srclink"href="https://doc.rust-lang.org/1.58.0/src/core/convert/mod.rs.html#573-582"title="goto source code">[src]</a></div><ahref="#impl-TryInto%3CU%3E"class="anchor"></a><h3class="code-header in-band">impl<T, U><aclass="trait"href="https://doc.rust-lang.org/1.58.0/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/1.58.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>, </span></h3></div></summary><divclass="impl-items"><detailsclass="rustdoc-toggle"open><summary><divid="associatedtype.Error-1"class="type trait-impl has-srclink"><ahref="#associatedtype.Error-1"class="anchor"></a><h4class="code-header">type <ahref="https://doc.rust-lang.org/1.58.0/core/convert/trait.TryInto.html#associatedtype.Error"class="type">Error</a> = <U as <aclass="trait"href="https://doc.rust-lang.org/1.58.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="type"href="https://doc.rust-lang.org/1.58.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a></h4></div></summary><divclass='docblock'><p>The type returned in the event of a conversion error.</p>
</div></details><detailsclass="rustdoc-toggle method-toggle"open><summary><divid="method.try_into"class="method trait-impl has-srclink"><divclass="rightside"><aclass="srclink"href="https://doc.rust-lang.org/1.58.0/src/core/convert/mod.rs.html#579"title="goto source code">[src]</a></div><ahref="#method.try_into"class="anchor"></a><h4class="code-header">pub fn <ahref="https://doc.rust-lang.org/1.58.0/core/convert/trait.TryInto.html#tymethod.try_into"class="fnname">try_into</a>(self) -><aclass="enum"href="https://doc.rust-lang.org/1.58.0/core/result/enum.Result.html"title="enum core::result::Result">Result</a><U, <U as <aclass="trait"href="https://doc.rust-lang.org/1.58.0/core/convert/trait.TryFrom.html"title="trait core::convert::TryFrom">TryFrom</a><T>>::<aclass="type"href="https://doc.rust-lang.org/1.58.0/core/convert/trait.TryFrom.html#associatedtype.Error"title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><divclass='docblock'><p>Performs the conversion.</p>