dear_imgui_rs/widget/table/
tokens.rs1use crate::sys;
2use crate::ui::Ui;
3
4#[must_use]
6pub struct TableToken<'ui> {
7 _ui: &'ui Ui,
8}
9
10impl<'ui> TableToken<'ui> {
11 pub(crate) fn new(ui: &'ui Ui) -> Self {
13 TableToken { _ui: ui }
14 }
15
16 pub fn end(self) {
18 }
20}
21
22impl<'ui> Drop for TableToken<'ui> {
23 fn drop(&mut self) {
24 unsafe {
25 sys::igEndTable();
26 }
27 }
28}
29
30#[must_use = "dropping the token pops the table background draw channel immediately"]
32pub struct TableBackgroundChannelToken<'ui> {
33 _ui: &'ui Ui,
34}
35
36impl<'ui> TableBackgroundChannelToken<'ui> {
37 pub(crate) fn new(ui: &'ui Ui) -> Self {
38 Self { _ui: ui }
39 }
40
41 pub fn pop(self) {}
43
44 pub fn end(self) {}
46}
47
48impl Drop for TableBackgroundChannelToken<'_> {
49 fn drop(&mut self) {
50 unsafe {
51 sys::igTablePopBackgroundChannel();
52 }
53 }
54}
55
56#[must_use = "dropping the token pops the table column draw channel immediately"]
58pub struct TableColumnChannelToken<'ui> {
59 _ui: &'ui Ui,
60}
61
62impl<'ui> TableColumnChannelToken<'ui> {
63 pub(crate) fn new(ui: &'ui Ui) -> Self {
64 Self { _ui: ui }
65 }
66
67 pub fn pop(self) {}
69
70 pub fn end(self) {}
72}
73
74impl Drop for TableColumnChannelToken<'_> {
75 fn drop(&mut self) {
76 unsafe {
77 sys::igTablePopColumnChannel();
78 }
79 }
80}