Skip to main content

RenderCtx

Struct RenderCtx 

Source
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: Instant

Implementations§

Source§

impl<'a, 'f> RenderCtx<'a, 'f>

Source

pub fn new( frame: &'a mut Frame<'f>, theme: &'a Theme, caps: &'a TerminalCaps, ) -> Self

Source

pub fn theme(&self) -> &Theme

Source

pub fn caps(&self) -> &TerminalCaps

Source

pub fn buffer_mut(&mut self) -> &mut Buffer

Source

pub fn area(&self) -> Rect

Source

pub fn set_cursor(&mut self, pos: Position)

Source

pub fn hide_cursor(&mut self)

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more