pub struct LifecycleConfig {
pub on_close: Vec<Box<dyn FnMut(&mut dyn UiCtx) + Send + Sync>>,
pub on_resize: Vec<Box<dyn FnMut(&mut dyn UiCtx) + Send + Sync>>,
pub on_focus: Vec<Box<dyn FnMut(&mut dyn UiCtx) + Send + Sync>>,
}Expand description
Lifecycle callbacks handed to a BackendRunner at startup.
Each field is the exact hook vector registered on the crate::App via
crate::App::on_close / crate::App::on_resize / crate::App::on_focus.
Backends fire these against a NullUiCtx when the matching
window event fires, because lifecycle events happen outside a live drawing
frame (there is no EguiUiCtx / IcedUiCtx bound at that point).
The size / focus values that drive the event stream are consumed by the
LifecycleTracker for change-detection; the hooks themselves take the
established FnMut(&mut dyn UiCtx) shape. A future typed-argument lifecycle
API (passing the new size / focus state into the hook) is out of scope for
this release.
Fields§
§on_close: Vec<Box<dyn FnMut(&mut dyn UiCtx) + Send + Sync>>Hooks fired once when the window is closing.
on_resize: Vec<Box<dyn FnMut(&mut dyn UiCtx) + Send + Sync>>Hooks fired whenever the window size changes.
on_focus: Vec<Box<dyn FnMut(&mut dyn UiCtx) + Send + Sync>>Hooks fired whenever the window gains or loses focus.
Trait Implementations§
Source§impl Default for LifecycleConfig
impl Default for LifecycleConfig
Source§fn default() -> LifecycleConfig
fn default() -> LifecycleConfig
Auto Trait Implementations§
impl !RefUnwindSafe for LifecycleConfig
impl !UnwindSafe for LifecycleConfig
impl Freeze for LifecycleConfig
impl Send for LifecycleConfig
impl Sync for LifecycleConfig
impl Unpin for LifecycleConfig
impl UnsafeUnpin for LifecycleConfig
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> DowncastSync for T
impl<T> DowncastSync for T
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