pub struct FrameUpdate { /* private fields */ }
Expand description
A frame quick update.
A frame update causes a frame render without needing to fully rebuild the display list. It is a more performant but also more limited way of generating a frame.
Any FrameValueKey
used in the creation of the frame can be used for updating the frame.
Implementations§
source§impl FrameUpdate
impl FrameUpdate
sourcepub fn new(
render_update_widgets: Arc<RenderUpdates>,
frame_id: FrameId,
root_id: WidgetId,
root_bounds: WidgetBoundsInfo,
clear_color: Rgba,
) -> FrameUpdate
pub fn new( render_update_widgets: Arc<RenderUpdates>, frame_id: FrameId, root_id: WidgetId, root_bounds: WidgetBoundsInfo, clear_color: Rgba, ) -> FrameUpdate
New frame update builder.
render_update_widgets
- External update requests.frame_id
- Id of the new frame.root_id
- Id of the window root widget.root_bounds
- Bounds info of the window root widget.clear_color
- The current clear color.
sourcepub fn is_outer(&self) -> bool
pub fn is_outer(&self) -> bool
Returns true
if the widget inner transform update is still being build.
This is true
when inside an update_widget
call but false
when inside an update_inner
call.
sourcepub fn transform(&self) -> &PxTransform
pub fn transform(&self) -> &PxTransform
Current transform.
sourcepub fn set_clear_color(&mut self, color: Rgba)
pub fn set_clear_color(&mut self, color: Rgba)
Change the color used to clear the pixel buffer when redrawing the frame.
sourcepub fn auto_hit_test(&self) -> bool
pub fn auto_hit_test(&self) -> bool
Returns true
if all transform updates are also applied to hit-test transforms.
sourcepub fn with_auto_hit_test(
&mut self,
auto_hit_test: bool,
render_update: impl FnOnce(&mut FrameUpdate),
)
pub fn with_auto_hit_test( &mut self, auto_hit_test: bool, render_update: impl FnOnce(&mut FrameUpdate), )
Runs render_update
with auto_hit_test
set to a value for the duration of the render
call.
sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Returns true
if view updates are actually collected, if false
only transforms and hit-test are updated.
Calls update
with is_visible
set to false
.
Nodes that set the visibility to Hidden
must render using the FrameBuilder::hide
method and update using this method.
sourcepub fn update_transform(
&mut self,
new_value: FrameValueUpdate<PxTransform>,
hit_test: bool,
)
pub fn update_transform( &mut self, new_value: FrameValueUpdate<PxTransform>, hit_test: bool, )
Update a transform value that does not potentially affect widget bounds.
Use with_transform
to update transforms that affect widget bounds.
If hit_test
is true
the hit-test transform is also updated.
sourcepub fn update_transform_opt(
&mut self,
new_value: Option<FrameValueUpdate<PxTransform>>,
hit_test: bool,
)
pub fn update_transform_opt( &mut self, new_value: Option<FrameValueUpdate<PxTransform>>, hit_test: bool, )
Update a transform value, if there is one.
sourcepub fn with_transform(
&mut self,
new_value: FrameValueUpdate<PxTransform>,
hit_test: bool,
render_update: impl FnOnce(&mut FrameUpdate),
)
pub fn with_transform( &mut self, new_value: FrameValueUpdate<PxTransform>, hit_test: bool, render_update: impl FnOnce(&mut FrameUpdate), )
Update a transform that potentially affects widget bounds.
The transform
is updated to include this space for the call to the render_update
closure. The closure
must call render update on child nodes.
If hit_test
is true
the hit-test transform is also updated.
sourcepub fn with_transform_opt(
&mut self,
new_value: Option<FrameValueUpdate<PxTransform>>,
hit_test: bool,
render_update: impl FnOnce(&mut FrameUpdate),
)
pub fn with_transform_opt( &mut self, new_value: Option<FrameValueUpdate<PxTransform>>, hit_test: bool, render_update: impl FnOnce(&mut FrameUpdate), )
Update a transform that potentially affects widget bounds, if there is one.
The render_update
is always called.
sourcepub fn with_child(
&mut self,
offset: Vector2D<Px, Px>,
render_update: impl FnOnce(&mut FrameUpdate),
)
pub fn with_child( &mut self, offset: Vector2D<Px, Px>, render_update: impl FnOnce(&mut FrameUpdate), )
Calls render_update
with an offset
that affects the first inner child inner bounds.
Nodes that used FrameBuilder::push_child
during render must use this method to update the value.
sourcepub fn with_transform_value(
&mut self,
value: &PxTransform,
render_update: impl FnOnce(&mut FrameUpdate),
)
pub fn with_transform_value( &mut self, value: &PxTransform, render_update: impl FnOnce(&mut FrameUpdate), )
Calls render_update
while the transform
is updated to include the value
space.
This is useful for cases where the inner transforms are affected by a value
that is only rendered, never updated.
sourcepub fn with_inner_transform(
&mut self,
transform: &PxTransform,
render_update: impl FnOnce(&mut FrameUpdate),
)
pub fn with_inner_transform( &mut self, transform: &PxTransform, render_update: impl FnOnce(&mut FrameUpdate), )
Update the transform applied after the inner bounds translate.
This is only valid if is_outer
.
sourcepub fn can_reuse_widget(&self) -> bool
pub fn can_reuse_widget(&self) -> bool
If widget update can be skipped by setting reuse in update_widget
.
sourcepub fn with_no_reuse(&mut self, render_update: impl FnOnce(&mut FrameUpdate))
pub fn with_no_reuse(&mut self, render_update: impl FnOnce(&mut FrameUpdate))
Calls render_update
with can_reuse_widget
set to false
.
sourcepub fn update_widget(&mut self, render_update: impl FnOnce(&mut FrameUpdate))
pub fn update_widget(&mut self, render_update: impl FnOnce(&mut FrameUpdate))
Update the widget’s outer transform.
If render-update was not requested for the widget and can_reuse_widget
only update outer/inner transforms of descendants.
If the widget is reused the render_update
is not called.
sourcepub fn reuse_widget(&mut self)
pub fn reuse_widget(&mut self)
Update the info transforms of the widget and descendants.
Widgets that did not request render-update can use this method to update only the outer and inner transforms of itself and descendants as those values are global and the parent widget may have changed.
sourcepub fn update_inner(
&mut self,
layout_translation_key: FrameValueKey<PxTransform>,
layout_translation_animating: bool,
render_update: impl FnOnce(&mut FrameUpdate),
)
pub fn update_inner( &mut self, layout_translation_key: FrameValueKey<PxTransform>, layout_translation_animating: bool, render_update: impl FnOnce(&mut FrameUpdate), )
Update the widget’s inner transform.
The layout_translation_animating
affects some webrender caches, see FrameBuilder::push_inner
for details.
sourcepub fn update_f32(&mut self, new_value: FrameValueUpdate<f32>)
pub fn update_f32(&mut self, new_value: FrameValueUpdate<f32>)
Update a float value.
sourcepub fn update_f32_opt(&mut self, new_value: Option<FrameValueUpdate<f32>>)
pub fn update_f32_opt(&mut self, new_value: Option<FrameValueUpdate<f32>>)
Update a float value, if there is one.
sourcepub fn update_color(&mut self, new_value: FrameValueUpdate<Rgba>)
pub fn update_color(&mut self, new_value: FrameValueUpdate<Rgba>)
Update a color value.
See FrameBuilder::push_color
for details.
sourcepub fn update_color_opt(&mut self, new_value: Option<FrameValueUpdate<Rgba>>)
pub fn update_color_opt(&mut self, new_value: Option<FrameValueUpdate<Rgba>>)
Update a color value, if there is one.
sourcepub fn update_extension_raw(
&mut self,
extension_id: ApiExtensionId,
extension_payload: ApiExtensionPayload,
)
pub fn update_extension_raw( &mut self, extension_id: ApiExtensionId, extension_payload: ApiExtensionPayload, )
Update a custom extension value with custom encoding.
sourcepub fn update_extension<T>(&mut self, extension_id: ApiExtensionId, payload: &T)where
T: Serialize,
pub fn update_extension<T>(&mut self, extension_id: ApiExtensionId, payload: &T)where
T: Serialize,
Update a custom extension value.
sourcepub fn parallel_split(&self) -> ParallelBuilder<FrameUpdate>
pub fn parallel_split(&self) -> ParallelBuilder<FrameUpdate>
Create an update builder that can be send to a parallel task and must be folded back into this builder.
This should be called just before the call to update_widget
, an error is traced if called inside a widget outer bounds.
sourcepub fn parallel_fold(&mut self, split: ParallelBuilder<FrameUpdate>)
pub fn parallel_fold(&mut self, split: ParallelBuilder<FrameUpdate>)
Collect updates from split
into self
.
sourcepub fn with_nested_window(
&mut self,
render_update_widgets: Arc<RenderUpdates>,
root_id: WidgetId,
root_bounds: WidgetBoundsInfo,
update: impl FnOnce(&mut FrameUpdate),
)
pub fn with_nested_window( &mut self, render_update_widgets: Arc<RenderUpdates>, root_id: WidgetId, root_bounds: WidgetBoundsInfo, update: impl FnOnce(&mut FrameUpdate), )
Calls update
to render update a separate nested window on this frame.
sourcepub fn render_update_widgets(&self) -> &Arc<RenderUpdates>
pub fn render_update_widgets(&self) -> &Arc<RenderUpdates>
External render update requests for this frame.
sourcepub fn finalize(self, info_tree: &WidgetInfoTree) -> BuiltFrameUpdate
pub fn finalize(self, info_tree: &WidgetInfoTree) -> BuiltFrameUpdate
Finalize the update.
Returns the property updates and the new clear color if any was set.
Auto Trait Implementations§
impl Freeze for FrameUpdate
impl !RefUnwindSafe for FrameUpdate
impl Send for FrameUpdate
impl Sync for FrameUpdate
impl Unpin for FrameUpdate
impl !UnwindSafe for FrameUpdate
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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