pub struct ComponentFactoryManager { /* private fields */ }Expand description
组件工厂管理器,负责注册和管理组件工厂
Implementations§
Source§impl ComponentFactoryManager
impl ComponentFactoryManager
Sourcepub fn register_component_factory<Comp, F, Fut>(
&self,
label: Option<String>,
factory: F,
)where
Comp: DynComponent + 'static,
F: Fn(Arc<ApplicationInner>, String) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Comp>> + Send + 'static,
pub fn register_component_factory<Comp, F, Fut>(
&self,
label: Option<String>,
factory: F,
)where
Comp: DynComponent + 'static,
F: Fn(Arc<ApplicationInner>, String) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<Comp>> + Send + 'static,
注册组件工厂
Sourcepub fn take_factories(
&self,
) -> (Vec<(ComponentKey, ComponentFactory)>, HashSet<ComponentKey>)
pub fn take_factories( &self, ) -> (Vec<(ComponentKey, ComponentFactory)>, HashSet<ComponentKey>)
取出所有工厂并清空内部存储
Sourcepub fn is_registered(&self, key: &ComponentKey) -> bool
pub fn is_registered(&self, key: &ComponentKey) -> bool
检查组件是否已注册
Sourcepub fn get_registered_keys(&self) -> Vec<ComponentKey>
pub fn get_registered_keys(&self) -> Vec<ComponentKey>
获取所有已注册组件的键
Trait Implementations§
Source§impl Default for ComponentFactoryManager
impl Default for ComponentFactoryManager
Source§fn default() -> ComponentFactoryManager
fn default() -> ComponentFactoryManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for ComponentFactoryManager
impl RefUnwindSafe for ComponentFactoryManager
impl Send for ComponentFactoryManager
impl Sync for ComponentFactoryManager
impl Unpin for ComponentFactoryManager
impl UnsafeUnpin for ComponentFactoryManager
impl UnwindSafe for ComponentFactoryManager
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
Mutably borrows from an owned value. Read more