Skip to main content

ActivityManager

Struct ActivityManager 

Source
pub struct ActivityManager<R, H, C>
where R: Route, H: ActivityHost, C: Clone + Send + Sync + 'static,
{ /* private fields */ }
Expand description

任务栈与页面管理器。 维护 Activity 实例堆栈、分发生命周期、并向外暴露最终要渲染的视图层级。

Implementations§

Source§

impl<R, H, C> ActivityManager<R, H, C>
where R: Route, H: ActivityHost, C: Clone + Send + Sync + 'static,

Source

pub fn new( initial_route: R, context: C, factory: Box<dyn Fn(&R, &C) -> Box<dyn Activity<R, H, C>>>, ) -> (Self, Vec<H::Effect>)

初始化 Activity Manager 并启动初始根页面。

Source

pub fn start_activity(&mut self, intent: Intent<R>) -> Vec<H::Effect>

启动目标 Activity,处理复杂的 LaunchMode 出入栈逻辑。

Source

pub fn back(&mut self) -> Vec<H::Effect>

执行返回/后退操作。

Source

pub fn update(&mut self, message: H::Message) -> Vec<H::Effect>

派发消息事件给当前处于活跃状态的页面

Source

pub fn views(&self) -> Vec<H::View>

提取需要渲染的视图层级(画家算法计算)。

Source

pub fn subscriptions(&self) -> Vec<H::Subscription>

提取需要监听的订阅事件(同样受 translucent 机制影响)。

Auto Trait Implementations§

§

impl<R, H, C> Freeze for ActivityManager<R, H, C>
where C: Freeze,

§

impl<R, H, C> !RefUnwindSafe for ActivityManager<R, H, C>

§

impl<R, H, C> !Send for ActivityManager<R, H, C>

§

impl<R, H, C> !Sync for ActivityManager<R, H, C>

§

impl<R, H, C> Unpin for ActivityManager<R, H, C>
where C: Unpin,

§

impl<R, H, C> UnsafeUnpin for ActivityManager<R, H, C>
where C: UnsafeUnpin,

§

impl<R, H, C> !UnwindSafe for ActivityManager<R, H, C>

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.