From 69fb34f0f8682ada766f7623c5ca626c219d9991 Mon Sep 17 00:00:00 2001 From: dbr Date: Thu, 10 Feb 2022 11:07:04 +1100 Subject: [PATCH] Fix up running of begin_combo doctest --- imgui/src/widget/combo_box.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/imgui/src/widget/combo_box.rs b/imgui/src/widget/combo_box.rs index cdf1df5..6ca4b35 100644 --- a/imgui/src/widget/combo_box.rs +++ b/imgui/src/widget/combo_box.rs @@ -205,9 +205,12 @@ impl Ui { /// # Example /// /// ```rust,no_run + /// # let mut ctx = imgui::Context::create(); + /// # {let ui = ctx.frame(); + /// /// let items = vec!["Example 1", "Example 2"]; /// let mut selected = &items[0]; - /// if let Some(cb) = ui.begin_combo("example_combo") { + /// if let Some(cb) = ui.begin_combo("example_combo", format!("Selected item: {}", selected)) { /// for cur in &items { /// if selected == cur { /// // Auto-scroll to selected item @@ -223,6 +226,7 @@ impl Ui { /// } /// } /// } + /// # }; /// ``` #[must_use] #[doc(alias = "BeginCombo")]