pub struct AppContext { /* private fields */ }Expand description
the context to store all beans.
AppContext owns the ownership of all registered beans.
When AppContext is dropped, all beans will be dropped too
Implementations§
Source§impl AppContext
impl AppContext
Sourcepub fn try_acquire_bean<T>(&self, name: &'static str) -> Option<BeanRef<T>>
pub fn try_acquire_bean<T>(&self, name: &'static str) -> Option<BeanRef<T>>
the method try_acquire_bean can be used to get bean from runtime,
like ApplicationContext in SpringBoot
pub fn acquire_bean<T>( &self, _ty: BeanType<T>, name: &'static str, ) -> BeanRef<T>
Sourcepub fn acquire_beans_by_type<T>(&self, _ty: BeanType<T>) -> Vec<BeanRef<T>>
pub fn acquire_beans_by_type<T>(&self, _ty: BeanType<T>) -> Vec<BeanRef<T>>
the method try_acquire_beans_by_type can be used to get multiple beans with same type
Sourcepub fn acquire_beans_by_name<T>(&self, name: &'static str) -> Vec<BeanRef<T>>
pub fn acquire_beans_by_name<T>(&self, name: &'static str) -> Vec<BeanRef<T>>
the method try_acquire_beans_by_name can be used to get multiple beans with same name
Sourcepub fn is_last_clone(&self) -> bool
pub fn is_last_clone(&self) -> bool
whether current AppContext do not contains any arc clone
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppContext
impl !RefUnwindSafe for AppContext
impl Send for AppContext
impl Sync for AppContext
impl Unpin for AppContext
impl !UnwindSafe for AppContext
Blanket Implementations§
Source§impl<T> BeanTypeOf<T> for T
impl<T> BeanTypeOf<T> for T
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