pub struct Renderer<K: Clone + Ord + Send + Sync + 'static> { /* private fields */ }Expand description
Renderer stores widget content, lays it out, and draws it to a terminal.
Implementations§
Source§impl<K: Clone + Ord + Send + Sync + 'static> Renderer<K>
impl<K: Clone + Ord + Send + Sync + 'static> Renderer<K>
pub fn try_new() -> Result<Self>
pub async fn try_new_with_graphemes<I, G>(init: I, draw: bool) -> Result<Self>
pub fn update<I, G>(&self, items: I) -> &Self
pub fn remove<I>(&self, items: I) -> &Selfwhere
I: IntoIterator<Item = K>,
Sourcepub fn hit_test(&self, position: ScreenPosition) -> Option<WidgetPosition<K>>
pub fn hit_test(&self, position: ScreenPosition) -> Option<WidgetPosition<K>>
Returns the content position under a terminal screen position.
This always uses the layout from the most recently completed render.
Sourcepub fn screen_position(
&self,
position: WidgetPosition<K>,
) -> Option<ScreenPosition>
pub fn screen_position( &self, position: WidgetPosition<K>, ) -> Option<ScreenPosition>
Returns the screen position for a widget content position when it is visible.
Sourcepub async fn render(&self) -> Result<()>
pub async fn render(&self) -> Result<()>
Lays out all current widget outputs and renders their visible viewports.
Viewport offsets persist by item key. They remain stable while a cursor is visible, move only when it crosses a viewport edge, and are clamped when content or terminal dimensions shrink.
Auto Trait Implementations§
impl<K> !Freeze for Renderer<K>
impl<K> !RefUnwindSafe for Renderer<K>
impl<K> !UnwindSafe for Renderer<K>
impl<K> Send for Renderer<K>
impl<K> Sync for Renderer<K>
impl<K> Unpin for Renderer<K>where
K: Unpin,
impl<K> UnsafeUnpin for Renderer<K>
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