pub struct ViewBuffer<'a> { /* private fields */ }Expand description
Render to the temp buffer.
- It maps your widget area from layout coordinates to screen coordinates before rendering.
- It helps with cleanup of the widget state if your widget is currently invisible.
Implementations§
Source§impl<'a> ViewBuffer<'a>
impl<'a> ViewBuffer<'a>
Sourcepub fn render_widget<W>(&mut self, widget: W, area: Rect)where
W: Widget,
pub fn render_widget<W>(&mut self, widget: W, area: Rect)where
W: Widget,
Render a widget to the temp buffer.
Sourcepub fn render_stateful<W, S>(&mut self, widget: W, area: Rect, state: &mut S)where
W: StatefulWidget<State = S>,
S: RelocatableState,
pub fn render_stateful<W, S>(&mut self, widget: W, area: Rect, state: &mut S)where
W: StatefulWidget<State = S>,
S: RelocatableState,
Render a widget to the temp buffer. This expects that the state is a RelocatableState.
Sourcepub fn is_visible_area(&self, area: Rect) -> bool
pub fn is_visible_area(&self, area: Rect) -> bool
Is the given area visible?
Sourcepub fn locate_area(&self, area: Rect) -> Rect
pub fn locate_area(&self, area: Rect) -> Rect
Does nothing for view. Only exists to match Clipper.
Sourcepub fn relocate<S>(&self, state: &mut S)where
S: RelocatableState,
pub fn relocate<S>(&self, state: &mut S)where
S: RelocatableState,
After rendering the widget to the buffer it may have stored areas in its state. These will be in buffer coordinates instead of screen coordinates.
Call this function to correct this after rendering.
If a widget is not rendered because it is out of the buffer area, it may still have left over areas in its state.
This uses the mechanism for relocate to zero them out.
Sourcepub fn buffer(&mut self) -> &mut Buffer
pub fn buffer(&mut self) -> &mut Buffer
Access the temporary buffer.
Note Use of render_widget is preferred.
Sourcepub fn into_widget(self) -> ViewWidget<'a>
pub fn into_widget(self) -> ViewWidget<'a>
Rendering the content is finished.
Convert to the output widget that can be rendered in the target area.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ViewBuffer<'a>
impl<'a> RefUnwindSafe for ViewBuffer<'a>
impl<'a> Send for ViewBuffer<'a>
impl<'a> Sync for ViewBuffer<'a>
impl<'a> Unpin for ViewBuffer<'a>
impl<'a> UnwindSafe for ViewBuffer<'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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more