pub struct Cached {
pub rect: Rect,
pub visible: bool,
/* private fields */
}Expand description
A component with memoized geometry, its last placed rectangle, and any in-flight property transitions.
Fields§
§rect: RectLast outer rectangle assigned by layout.
visible: boolWhether the component participates in layout, paint, and focus.
Implementations§
Source§impl Cached
impl Cached
Sourcepub fn measure(&mut self, ctx: &UiContext) -> (u16, u16)
pub fn measure(&mut self, ctx: &UiContext) -> (u16, u16)
Returns memoized outer width bounds, including padding and border.
The process-wide width epoch and the context revision are part of the memo key, so changing the terminal’s Jamo policy or swapping the presentation context remeasures unchanged component trees.
Sourcepub fn height(&mut self, ctx: &UiContext, width: u16) -> u16
pub fn height(&mut self, ctx: &UiContext, width: u16) -> u16
Returns memoized outer height at width, including padding and border.
Sourcepub fn place(&mut self, ctx: &UiContext, rect: Rect)
pub fn place(&mut self, ctx: &UiContext, rect: Rect)
Stores the outer rectangle and places children inside its content box.
A lift component rests at the bottom of its rectangle; the reserved
headroom above is where the chrome rises while hovered.
Sourcepub fn paint(&mut self, pc: &mut PaintCtx<'_>)
pub fn paint(&mut self, pc: &mut PaintCtx<'_>)
Paints border and content, then restores this component’s background.
When anim/spin properties are live, sampled solid colors are
swapped into the props for the duration of this call and restored
afterward, so content and chrome both paint the mid-flight value.
Hover chrome follows the pointer or keyboard focus: a ramped hover
under a live pointer renders as a tracking glow over the resting
chrome, under keyboard focus it blooms from the chrome’s center
until it blankets the ring, every other hovered case swaps into the
border slot, and lift raises the chrome into the headroom its
rectangle reserves, leaving a shadow.
Sourcepub const fn invalidate(&mut self)
pub const fn invalidate(&mut self)
Invalidates both geometry memos.
Sourcepub fn update<R>(
&mut self,
slot: Slot,
f: impl FnOnce(&mut Self) -> (R, bool),
) -> Option<R>
pub fn update<R>( &mut self, slot: Slot, f: impl FnOnce(&mut Self) -> (R, bool), ) -> Option<R>
Mutates a component selected by slot and invalidates a dirty ancestor path.
Sourcepub fn update_id<R>(
&mut self,
id: &str,
f: impl FnOnce(&mut Self) -> (R, bool),
) -> Option<R>
pub fn update_id<R>( &mut self, id: &str, f: impl FnOnce(&mut Self) -> (R, bool), ) -> Option<R>
Mutates a component selected by id and invalidates a dirty ancestor
path.
Trait Implementations§
Source§impl IntoChildren for Cached
impl IntoChildren for Cached
Source§fn extend_children(self, out: &mut Vec<Cached>)
fn extend_children(self, out: &mut Vec<Cached>)
out.Auto Trait Implementations§
impl !RefUnwindSafe for Cached
impl !Send for Cached
impl !Sync for Cached
impl !UnwindSafe for Cached
impl Freeze for Cached
impl Unpin for Cached
impl UnsafeUnpin for Cached
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.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