pub struct RenderCtx<'a, 'f> {
pub focus: FocusTarget,
pub time: Instant,
/* private fields */
}Expand description
Two lifetimes are required: 'a is the outer &mut Frame borrow passed
into RenderCtx::new, and 'f is the frame’s own buffer lifetime. ratatui
0.30’s Terminal::draw callback produces a &mut Frame<'_> whose buffer
outlives the local borrow, so collapsing both into one lifetime does not
compile. Downstream code that just uses &RenderCtx elides the lifetimes
to RenderCtx<'_, '_>.
Fields§
§focus: FocusTarget§time: InstantImplementations§
Source§impl<'a, 'f> RenderCtx<'a, 'f>
impl<'a, 'f> RenderCtx<'a, 'f>
pub fn new( frame: &'a mut Frame<'f>, theme: &'a Theme, caps: &'a TerminalCaps, ) -> Self
pub fn theme(&self) -> &Theme
pub fn caps(&self) -> &TerminalCaps
pub fn buffer_mut(&mut self) -> &mut Buffer
pub fn area(&self) -> Rect
pub fn set_cursor(&mut self, pos: Position)
pub fn hide_cursor(&mut self)
pub fn emit_link(&mut self, range: CellRange, target: LinkTarget)
Sourcepub fn with_frame<R>(&mut self, f: impl FnOnce(&mut Frame<'f>) -> R) -> R
pub fn with_frame<R>(&mut self, f: impl FnOnce(&mut Frame<'f>) -> R) -> R
Access the underlying Frame for legacy bridging.
Used by LegacyOverlayAdapter to forward Renderable::render calls
to legacy Overlay implementations that operate on a raw
&mut Frame. NOTE: This is a temporary bridge API. Once all overlays
are migrated to Renderable, this accessor should be removed.
Auto Trait Implementations§
impl<'a, 'f> !UnwindSafe for RenderCtx<'a, 'f>
impl<'a, 'f> Freeze for RenderCtx<'a, 'f>
impl<'a, 'f> RefUnwindSafe for RenderCtx<'a, 'f>
impl<'a, 'f> Send for RenderCtx<'a, 'f>
impl<'a, 'f> Sync for RenderCtx<'a, 'f>
impl<'a, 'f> Unpin for RenderCtx<'a, 'f>
impl<'a, 'f> UnsafeUnpin for RenderCtx<'a, 'f>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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