pub struct PlotAppearScope { /* private fields */ }Expand description
Remembers which plots inside it have finished appearing, so a plot that is painted again after a gap — a row a virtual list scrolled out of view and back — shows its data whole instead of drawing in again.
Wrap the list, or whatever region repaints its plots on and off, in one:
PlotAppearScope::new(("transcript", conversation_id), list(state, render_row).flex_1())A plot is remembered by its global element id and its
Plot::appear_generation, once its appear
has finished; a new generation still replays it, and one taken away
mid-appear draws in again from the start. The memory is the scope’s own
element state: it lasts while the scope is painted every frame and goes with
it, so a view that is closed, or a scope whose id changes — name it after the
content, such as a conversation — draws its plots in afresh. The innermost
scope wins. Without one, every plot draws in each time it is painted anew.
The scope takes no part in layout: it hands on its child’s layout, so a
child that sizes itself, such as a list, keeps doing so.
Implementations§
Source§impl PlotAppearScope
impl PlotAppearScope
Sourcepub fn new(id: impl Into<ElementId>, child: impl IntoElement) -> PlotAppearScope
pub fn new(id: impl Into<ElementId>, child: impl IntoElement) -> PlotAppearScope
Remember the appears of the plots in child under id, unique among
its siblings.
Trait Implementations§
Source§impl Element for PlotAppearScope
impl Element for PlotAppearScope
Source§type RequestLayoutState = (Option<AnyElement>, Rc<RefCell<HashMap<GlobalElementId, u64>>>)
type RequestLayoutState = (Option<AnyElement>, Rc<RefCell<HashMap<GlobalElementId, u64>>>)
Element::request_layout. A mutable reference to this state is subsequently
provided to Element::prepaint and Element::paint.Source§type PrepaintState = ()
type PrepaintState = ()
Element::prepaint. A mutable reference to this state is subsequently
provided to Element::paint.Source§fn id(&self) -> Option<ElementId>
fn id(&self) -> Option<ElementId>
Source§fn source_location(&self) -> Option<&'static Location<'static>>
fn source_location(&self) -> Option<&'static Location<'static>>
Source§fn request_layout(
&mut self,
global_id: Option<&GlobalElementId>,
_: Option<&InspectorElementId>,
window: &mut Window,
cx: &mut App,
) -> (LayoutId, <PlotAppearScope as Element>::RequestLayoutState)
fn request_layout( &mut self, global_id: Option<&GlobalElementId>, _: Option<&InspectorElementId>, window: &mut Window, cx: &mut App, ) -> (LayoutId, <PlotAppearScope as Element>::RequestLayoutState)
Source§fn prepaint(
&mut self,
_: Option<&GlobalElementId>,
_: Option<&InspectorElementId>,
_: Bounds<Pixels>,
_: &mut <PlotAppearScope as Element>::RequestLayoutState,
window: &mut Window,
cx: &mut App,
) -> <PlotAppearScope as Element>::PrepaintState
fn prepaint( &mut self, _: Option<&GlobalElementId>, _: Option<&InspectorElementId>, _: Bounds<Pixels>, _: &mut <PlotAppearScope as Element>::RequestLayoutState, window: &mut Window, cx: &mut App, ) -> <PlotAppearScope as Element>::PrepaintState
Element::request_layout().Source§fn paint(
&mut self,
_: Option<&GlobalElementId>,
_: Option<&InspectorElementId>,
_: Bounds<Pixels>,
_: &mut <PlotAppearScope as Element>::RequestLayoutState,
_: &mut <PlotAppearScope as Element>::PrepaintState,
window: &mut Window,
cx: &mut App,
)
fn paint( &mut self, _: Option<&GlobalElementId>, _: Option<&InspectorElementId>, _: Bounds<Pixels>, _: &mut <PlotAppearScope as Element>::RequestLayoutState, _: &mut <PlotAppearScope as Element>::PrepaintState, window: &mut Window, cx: &mut App, )
Element::request_layout().Source§fn a11y_role(&self) -> Option<Role>
fn a11y_role(&self) -> Option<Role>
None are not included in the accessibility tree. Read moreSource§fn write_a11y_info(&self, _node: &mut Node)
fn write_a11y_info(&self, _node: &mut Node)
a11y_role() returns Some. Read moreSource§fn a11y_synthetic_children(
&mut self,
_prepaint: &mut Self::PrepaintState,
_builder: &mut A11ySubtreeBuilder<'_>,
)
fn a11y_synthetic_children( &mut self, _prepaint: &mut Self::PrepaintState, _builder: &mut A11ySubtreeBuilder<'_>, )
Source§fn into_any(self) -> AnyElement
fn into_any(self) -> AnyElement
AnyElement.Source§impl IntoElement for PlotAppearScope
impl IntoElement for PlotAppearScope
Source§type Element = PlotAppearScope
type Element = PlotAppearScope
Source§fn into_element(self) -> <PlotAppearScope as IntoElement>::Element
fn into_element(self) -> <PlotAppearScope as IntoElement>::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Auto Trait Implementations§
impl !RefUnwindSafe for PlotAppearScope
impl !Send for PlotAppearScope
impl !Sync for PlotAppearScope
impl !UnwindSafe for PlotAppearScope
impl Freeze for PlotAppearScope
impl Unpin for PlotAppearScope
impl UnsafeUnpin for PlotAppearScope
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
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> ⓘ
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