Skip to main content

ComponentLifecycle

Trait ComponentLifecycle 

pub trait ComponentLifecycle: Widget {
    // Provided methods
    fn unsaved_documents(&self, doc: &AutoCommit) -> Vec<UnsavedDocument> { ... }
    fn checkpoint_components(&mut self) -> Vec<String> { ... }
    fn finish_admitted_close(&mut self) -> Vec<ComponentCloseReport> { ... }
    fn close_components(&mut self) -> Vec<ComponentCloseReport> { ... }
    fn take_component_close_reports(&mut self) -> Vec<ComponentCloseReport> { ... }
    fn on_window_close_requested(&mut self) -> WindowCloseAdmission { ... }
    fn take_window_close_intent(&mut self) -> bool { ... }
    fn take_replacement(&mut self) -> Option<ComponentReplacement> { ... }
    fn take_save_status_presentation(&mut self) -> bool { ... }
}
Expand description

A widget owning components, documents or a window-close policy.

Provided Methods§

fn unsaved_documents(&self, doc: &AutoCommit) -> Vec<UnsavedDocument>

App-declared external document obligations. An in-memory record set is not evidence that an editable file has been saved.

fn checkpoint_components(&mut self) -> Vec<String>

Non-destructive persistence checkpoint. Never closes a wake scope or removes a tree; a failed host close must leave every child usable.

fn finish_admitted_close(&mut self) -> Vec<ComponentCloseReport>

Only the host may call this after every checkpoint succeeded, without dispatching another document mutation in between.

fn close_components(&mut self) -> Vec<ComponentCloseReport>

Capture and close nested components before removing their live trees, transferring all recovery reports to the caller.

fn take_component_close_reports(&mut self) -> Vec<ComponentCloseReport>

Drain inert close-report ownership once; never invoke ordinary app callbacks through a closed component.

fn on_window_close_requested(&mut self) -> WindowCloseAdmission

Admit or defer the primary native window’s ordinary close request. Roots that defer must later produce a one-shot close intent.

fn take_window_close_intent(&mut self) -> bool

One-shot approval after an earlier deferred ordinary window close.

fn take_replacement(&mut self) -> Option<ComponentReplacement>

The component this root’s own component asked to show in its place (AppComponent::take_replacement), for the host that mounted it. A component nested deeper answers to the host that mounted it, so the default reaches no child.

fn take_save_status_presentation(&mut self) -> bool

One-shot: the durability of this root’s own component’s record changed since this was last asked, and the root already synced with the new state. A host that asks (an App) presents it with a frame of its own, not a rebuilt tree; one that does not ask sees it through take_structure_dirty.

Implementors§