pub trait Activity<H: ActivityHost>: Send {
// Required methods
fn view<'a>(&'a self, context: &'a H::Context) -> H::View<'a>;
fn route(&self) -> H::Route;
// Provided methods
fn update(
&mut self,
_context: &mut H::Context,
_message: H::Message,
) -> H::Task { ... }
fn on_create(&mut self, _context: &mut H::Context) -> H::Task { ... }
fn on_resume(&mut self, _context: &mut H::Context) -> H::Task { ... }
fn on_pause(&mut self, _context: &mut H::Context) -> H::Task { ... }
fn on_destroy(&mut self, _context: &mut H::Context) -> H::Task { ... }
fn on_new_intent(
&mut self,
_context: &mut H::Context,
_route: H::Route,
) -> H::Task { ... }
}Expand description
页面组件特征。
代表一个拥有完整生命周期、独立状态并能响应全局上下文变化的页面模块。
Required Methods§
Provided Methods§
Sourcefn update(&mut self, _context: &mut H::Context, _message: H::Message) -> H::Task
fn update(&mut self, _context: &mut H::Context, _message: H::Message) -> H::Task
处理业务逻辑更新,并返回可能产生的异步任务。
Sourcefn on_destroy(&mut self, _context: &mut H::Context) -> H::Task
fn on_destroy(&mut self, _context: &mut H::Context) -> H::Task
生命周期钩子:页面实例被彻底销毁、移出堆栈前调用。
Sourcefn on_new_intent(
&mut self,
_context: &mut H::Context,
_route: H::Route,
) -> H::Task
fn on_new_intent( &mut self, _context: &mut H::Context, _route: H::Route, ) -> H::Task
生命周期钩子:当页面命中 SingleTop 或 SingleTask 复用机制时调用。