UPDATES

Struct 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>>, ) -> &UPDATES

Schedules an UpdateOp that optionally affects the target widget.

Source

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

Schedules an UpdateOp for the window only.

Source

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

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) -> &UPDATES

Schedules an update for the window only.

Source

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

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) -> &UPDATES

Schedules an info rebuild for the window only.

Source

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

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) -> &UPDATES

Schedules a layout update for the window only.

Source

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

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) -> &UPDATES

Schedules a new frame for the window only.

Source

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

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) -> &UPDATES

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>( &self, future: impl IntoFuture<Output = (), IntoFuture = F>, ) -> OnUpdateHandle
where F: Future<Output = ()> + Send + 'static,

Schedule the future to run in the app context, in the preview track of the next update.

This requests an app update. Each future awake also requests an app update and also runs in the preview track.

Returns a handle that can be dropped to cancel execution.

Source

pub fn run_hn_once( &self, handler: Box<dyn FnMut(&UpdateArgs) -> HandlerResult + Send>, ) -> OnUpdateHandle

Schedule a handler to run once in the app context, in the preview track of the next update.

The Handler can be any kind, including async handlers. If the handler is async and does not finish in one call it is scheduled to update in preview updates.

Returns a handle that can be dropped to cancel execution.

Source

pub fn on_pre_update( &self, handler: Box<dyn FnMut(&UpdateArgs) -> HandlerResult + Send>, ) -> 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 Handler, use the hn! or 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 APP_HANDLER.unsubscribe.

Source

pub fn on_update( &self, handler: Box<dyn FnMut(&UpdateArgs) -> HandlerResult + Send>, ) -> 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 Handler, use the hn! or 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 APP_HANDLER.unsubscribe.

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

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

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> 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
§

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> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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

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