pub trait ActivityHost: Sized + 'static {
type Message: Send + Debug;
type Context;
type Route: Route;
type View<'a>
where Self: 'a;
type Task;
// Required methods
fn empty_task() -> Self::Task;
fn batch_tasks(tasks: Vec<Self::Task>) -> Self::Task;
}Expand description
宿主环境抽象。
为框架提供类型映射,使其可以兼容不同的 UI 引擎(如 Iced、Dioxus 等)。
Required Associated Types§
Required Methods§
Sourcefn empty_task() -> Self::Task
fn empty_task() -> Self::Task
创建一个不执行任何操作的空任务。
作为任务系统的“单位元”,用于那些不需要产生副作用的生命周期钩子。
Sourcefn batch_tasks(tasks: Vec<Self::Task>) -> Self::Task
fn batch_tasks(tasks: Vec<Self::Task>) -> Self::Task
将多个异步任务合并为一个宏任务。
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.