pub struct CollapsingSection<'a> { /* private fields */ }Expand description
A collapsible content section.
CollapsingSection::new("advanced", "Show advanced options").show(ui, |ui| {
ui.label("…hidden until expanded…");
});Implementations§
Source§impl<'a> CollapsingSection<'a>
impl<'a> CollapsingSection<'a>
Sourcepub fn new(id_salt: impl Hash, label: impl Into<WidgetText>) -> Self
pub fn new(id_salt: impl Hash, label: impl Into<WidgetText>) -> Self
Create a collapsing section keyed by id_salt with the given header label.
The section is closed by default.
Sourcepub fn open(self, open: &'a mut bool) -> Self
pub fn open(self, open: &'a mut bool) -> Self
Bind the open state to a &mut bool the caller owns. If omitted,
the section remembers its state in egui’s temp storage.
Sourcepub fn default_open(self, open: bool) -> Self
pub fn default_open(self, open: bool) -> Self
Starting state when no prior state exists. Default: closed.
Sourcepub fn show<R>(
self,
ui: &mut Ui,
add_body: impl FnOnce(&mut Ui) -> R,
) -> InnerResponse<Option<R>>
pub fn show<R>( self, ui: &mut Ui, add_body: impl FnOnce(&mut Ui) -> R, ) -> InnerResponse<Option<R>>
Render the trigger row, and the body when open. Returns an
InnerResponse whose response is the trigger row (useful for
checking clicked(), hovered(), etc.) and whose inner is the
body closure’s return value, or None if the section is closed.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for CollapsingSection<'a>
impl<'a> RefUnwindSafe for CollapsingSection<'a>
impl<'a> Send for CollapsingSection<'a>
impl<'a> Sync for CollapsingSection<'a>
impl<'a> Unpin for CollapsingSection<'a>
impl<'a> UnsafeUnpin for CollapsingSection<'a>
impl<'a> !UnwindSafe for CollapsingSection<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more