Struct zng_app::update::UPDATES

source ·
pub struct UPDATES;
Expand description

Update schedule service.

Implementations§

source§

impl UPDATES

source

pub fn sender(&self) -> AppEventSender

Create an AppEventSender that can be used to awake the app and send app events from threads outside of the app.

source

pub fn waker(&self, target: impl Into<Option<WidgetId>>) -> Waker

Create an std task waker that wakes the event loop and updates.

source

pub fn update_op( &self, op: UpdateOp, target: impl Into<Option<WidgetId>> ) -> &Self

Schedules an UpdateOp that optionally affects the target widget.

source

pub fn update_op_window(&self, op: UpdateOp, target: WindowId) -> &Self

Schedules an UpdateOp for the window only.

source

pub fn update(&self, target: impl Into<Option<WidgetId>>) -> &Self

Schedules an update that affects the target.

After the current update cycle ends a new update will happen that includes the target widget.

source

pub fn update_window(&self, target: WindowId) -> &Self

Schedules an update for the window only.

source

pub fn update_info(&self, target: impl Into<Option<WidgetId>>) -> &Self

Schedules an info rebuild that affects the target.

After the current update cycle ends a new update will happen that requests an info rebuild that includes the target widget.

source

pub fn update_info_window(&self, target: WindowId) -> &Self

Schedules an info rebuild for the window only.

source

pub fn layout(&self, target: impl Into<Option<WidgetId>>) -> &Self

Schedules a layout update that affects the target.

After the current update cycle ends and there are no more updates requested a layout pass is issued that includes the target widget.

source

pub fn layout_window(&self, target: WindowId) -> &Self

Schedules a layout update for the window only.

source

pub fn render(&self, target: impl Into<Option<WidgetId>>) -> &Self

Schedules a full render that affects the target.

After the current update cycle ends and there are no more updates or layouts requested a render pass is issued that includes the target widget.

If no target is provided only the app extensions receive a render request.

source

pub fn render_window(&self, target: WindowId) -> &Self

Schedules a new frame for the window only.

source

pub fn render_update(&self, target: impl Into<Option<WidgetId>>) -> &Self

Schedules a render update that affects the target.

After the current update cycle ends and there are no more updates or layouts requested a render pass is issued that includes the target widget marked for render update only. Note that if a full render was requested for another widget on the same window this request is upgraded to a full frame render.

source

pub fn render_update_window(&self, target: WindowId) -> &Self

Schedules a render update for the window only.

source

pub fn is_pending_render(&self, window_id: WindowId) -> bool

Returns true is render or render update is requested for the window.

source

pub fn run<F: Future<Output = ()> + Send + 'static>( &self, future: F ) -> OnUpdateHandle

Schedule the future to run in the app context, each future awake work runs as a preview update.

Returns a handle that can be dropped to cancel execution.

source

pub fn run_hn_once<H: AppHandler<UpdateArgs>>( &self, handler: H ) -> OnUpdateHandle

Schedule an once handler to run when these updates are applied.

The callback is any of the once AppHandler, including async handlers. If the handler is async and does not finish in one call it is scheduled to update in preview updates.

source

pub fn on_pre_update<H>(&self, handler: H) -> OnUpdateHandle

Create a preview update handler.

The handler is called every time the app updates, just before the UI updates. It can be any of the non-async AppHandler, use the app_hn! or app_hn_once! macros to declare the closure. You must avoid using async handlers because UI bound async tasks cause app updates to awake, so it is very easy to lock the app in a constant sequence of updates. You can use run to start an async app context task.

Returns an OnUpdateHandle that can be used to unsubscribe, you can also unsubscribe from inside the handler by calling unsubscribe in the third parameter of app_hn! or async_app_hn!.

source

pub fn on_update<H>(&self, handler: H) -> OnUpdateHandle

Create an update handler.

The handler is called every time the app updates, just after the UI updates. It can be any of the non-async AppHandler, use the app_hn! or app_hn_once! macros to declare the closure. You must avoid using async handlers because UI bound async tasks cause app updates to awake, so it is very easy to lock the app in a constant sequence of updates. You can use run to start an async app context task.

Returns an OnUpdateHandle that can be used to unsubscribe, you can also unsubscribe from inside the handler by calling unsubscribe in the third parameter of app_hn! or async_app_hn!.

Auto Trait Implementations§

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.

§

impl<T> Instrument for T

§

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

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

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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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>,

§

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> StateValue for T
where T: Any + Send + Sync,