diff --git a/cursive-core/src/views/hideable_view.rs b/cursive-core/src/views/hideable_view.rs index ce6ce4a..e9ebab9 100644 --- a/cursive-core/src/views/hideable_view.rs +++ b/cursive-core/src/views/hideable_view.rs @@ -54,6 +54,13 @@ impl HideableView { self.with(Self::hide) } + /// Sets the visibility for this view to flag value. + /// Useful when creating views needs to be decided at runtime. + /// Chainable variant. + pub fn visible(self, flag: bool) -> Self { + self.with(|s| s.set_visible(flag)) + } + /// Returns `true` if the wrapped view is going to be visible. pub fn is_visible(&self) -> bool { self.visible