Slightly better doc for push_id

This commit is contained in:
dbr 2022-01-12 14:50:49 +11:00
parent b09b50e72c
commit 35342a0c82

View File

@ -356,7 +356,7 @@ impl Drop for ItemFlagsStackToken<'_> {
create_token!(
/// Tracks an ID pushed to the ID stack that can be popped by calling `.pop()`
/// or by dropping.
/// or by dropping. See [`crate::Ui::push_id`] for more details.
pub struct IdStackToken<'ui>;
/// Pops a change from the ID stack
@ -442,8 +442,12 @@ impl<'ui> Ui {
/// {
/// // Same for second callback. If we didn't do this, clicking the "Click" button
/// // would trigger both println statements!
/// let _id2 = ui.push_id("second");
/// let id2 = ui.push_id("second");
/// callback2(&ui);
/// // Here we manually end the scope. Typically letting it drop is neater
/// // but sometimes it's useful to end the scope earlier
/// id2.end();
/// ui.text("We can do other things, outside of the id2 scope");
/// }
/// });
/// ```