From 9417eb4c42abad582b16f88af844e39ead5ae7b3 Mon Sep 17 00:00:00 2001 From: Jack Mac Date: Sat, 25 Sep 2021 13:06:31 -0400 Subject: [PATCH] removed the other deprecation --- CHANGELOG.markdown | 2 +- imgui/src/stacks.rs | 83 --------------------------------------------- 2 files changed, 1 insertion(+), 84 deletions(-) diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index 8f2fd50..c89367b 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -4,7 +4,7 @@ - MSRV is now **1.54**. We soft-updated to this in 0.8.0 with a feature `min-const-generics`, which has now been removed (and as such, we resume having no default features). -- BREAKING: Removed `push_style_colors`. Instead, use `push_style_color` in a loop. This was deprecated in `0.7.0` and should have been removed in `0.8.0`. +- BREAKING: Removed `push_style_colors` and `push_style_vars`. Instead, use `push_style_color` in a loop. This was deprecated in `0.7.0` and should have been removed in `0.8.0`. This also removes their associated tokens. ## [0.8.0] - 2021-09-17 diff --git a/imgui/src/stacks.rs b/imgui/src/stacks.rs index 65c1c1a..a2037aa 100644 --- a/imgui/src/stacks.rs +++ b/imgui/src/stacks.rs @@ -1,7 +1,6 @@ use std::mem; use std::os::raw::{c_char, c_void}; use std::ptr; -use std::thread; use crate::context::Context; use crate::fonts::atlas::FontId; @@ -68,7 +67,6 @@ impl<'ui> Ui<'ui> { ColorStackToken::new(self) } - /// Changes a style variable by pushing a change to the style stack. /// /// Returns a `StyleStackToken` that can be popped by calling `.end()` @@ -89,39 +87,6 @@ impl<'ui> Ui<'ui> { unsafe { push_style_var(style_var) }; StyleStackToken::new(self) } - /// Changes style variables by pushing several changes to the style stack. - /// - /// Returns a `StyleStackToken` that must be popped by calling `.pop()` - /// - /// # Examples - /// - /// ```no_run - /// # use imgui::*; - /// # let mut ctx = Context::create(); - /// # let ui = ctx.frame(); - /// let styles = ui.push_style_vars(&[ - /// StyleVar::Alpha(0.2), - /// StyleVar::ItemSpacing([50.0, 50.0]) - /// ]); - /// ui.text("We're transparent..."); - /// ui.text("...with large spacing as well"); - /// styles.pop(&ui); - /// ``` - #[deprecated = "deprecated in 0.7.0. Use `push_style_var` multiple times for similar effect."] - pub fn push_style_vars<'a, I>(&self, style_vars: I) -> MultiStyleStackToken - where - I: IntoIterator, - { - let mut count = 0; - for &style_var in style_vars { - unsafe { push_style_var(style_var) }; - count += 1; - } - MultiStyleStackToken { - count, - ctx: self.ctx, - } - } } create_token!( @@ -156,30 +121,6 @@ impl ColorStackToken<'_> { } } -/// Tracks one or more changes pushed to the color stack that must be popped by calling `.pop()` -#[must_use] -pub struct MultiColorStackToken { - count: usize, - ctx: *const Context, -} - -impl MultiColorStackToken { - /// Pops changes from the color stack - #[doc(alias = "PopStyleColor")] - pub fn pop(mut self, _: &Ui<'_>) { - self.ctx = ptr::null(); - unsafe { sys::igPopStyleColor(self.count as i32) }; - } -} - -impl Drop for MultiColorStackToken { - fn drop(&mut self) { - if !self.ctx.is_null() && !thread::panicking() { - panic!("A ColorStackToken was leaked. Did you call .pop()?"); - } - } -} - create_token!( /// Tracks a style pushed to the style stack that can be popped by calling `.end()` /// or by dropping. @@ -196,30 +137,6 @@ impl StyleStackToken<'_> { } } -/// Tracks one or more changes pushed to the style stack that must be popped by calling `.pop()` -#[must_use] -pub struct MultiStyleStackToken { - count: usize, - ctx: *const Context, -} - -impl MultiStyleStackToken { - /// Pops changes from the style stack - #[doc(alias = "PopStyleVar")] - pub fn pop(mut self, _: &Ui<'_>) { - self.ctx = ptr::null(); - unsafe { sys::igPopStyleVar(self.count as i32) }; - } -} - -impl Drop for MultiStyleStackToken { - fn drop(&mut self) { - if !self.ctx.is_null() && !thread::panicking() { - panic!("A StyleStackToken was leaked. Did you call .pop()?"); - } - } -} - #[inline] unsafe fn push_style_var(style_var: StyleVar) { use crate::style::StyleVar::*;