From 83b6dc8d5f6471ff67efc483640c0b3c7e03cd1b Mon Sep 17 00:00:00 2001 From: Jack Mac Date: Fri, 24 Sep 2021 17:21:08 -0400 Subject: [PATCH] slightly borked the rebase --- imgui/src/utils.rs | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/imgui/src/utils.rs b/imgui/src/utils.rs index f26e875..b977c6d 100644 --- a/imgui/src/utils.rs +++ b/imgui/src/utils.rs @@ -5,6 +5,7 @@ use crate::input::mouse::MouseButton; use crate::math::MintVec2; use crate::style::StyleColor; use crate::sys; +use crate::Style; use crate::Ui; bitflags! { @@ -178,20 +179,20 @@ impl<'ui> Ui<'ui> { pub fn style_color(&self, style_color: StyleColor) -> [f32; 4] { self.ctx.style()[style_color] } -} -/// Returns a shared reference to the current [`Style`]. -/// -/// ## Safety -/// -/// This function is tagged as `unsafe` because pushing via -/// [`push_style_color`](crate::Ui::push_style_color) or -/// [`push_style_var`](crate::Ui::push_style_var) or popping via -/// [`ColorStackToken::pop`](crate::ColorStackToken::pop) or -/// [`StyleStackToken::pop`](crate::StyleStackToken::pop) will modify the values in the returned -/// shared reference. Therefore, you should not retain this reference across calls to push and -/// pop. The [`clone_style`](Ui::clone_style) version may instead be used to avoid `unsafe`. -#[doc(alias = "GetStyle")] -pub unsafe fn style(&self) -> &Style { - self.ctx.style() + /// Returns a shared reference to the current [`Style`]. + /// + /// ## Safety + /// + /// This function is tagged as `unsafe` because pushing via + /// [`push_style_color`](crate::Ui::push_style_color) or + /// [`push_style_var`](crate::Ui::push_style_var) or popping via + /// [`ColorStackToken::pop`](crate::ColorStackToken::pop) or + /// [`StyleStackToken::pop`](crate::StyleStackToken::pop) will modify the values in the returned + /// shared reference. Therefore, you should not retain this reference across calls to push and + /// pop. The [`clone_style`](Ui::clone_style) version may instead be used to avoid `unsafe`. + #[doc(alias = "GetStyle")] + pub unsafe fn style(&self) -> &Style { + self.ctx.style() + } }