pub struct AlgebraicEffect { /* private fields */ }Expand description
代数效应构建器
用于构建依赖容器并注册各种依赖。
Implementations§
Source§impl AlgebraicEffect
impl AlgebraicEffect
Sourcepub fn with<T: Send + Sync + 'static>(self, name: &str, service: T) -> Self
pub fn with<T: Send + Sync + 'static>(self, name: &str, service: T) -> Self
注册服务(按字符串键,默认单例作用域)
Sourcepub fn with_scope<T: Send + Sync + 'static>(
self,
name: &str,
service: T,
scope: Scope,
) -> Self
pub fn with_scope<T: Send + Sync + 'static>( self, name: &str, service: T, scope: Scope, ) -> Self
按作用域注册服务(按字符串键)
Sourcepub fn with_type_scope<T: Clone + Send + Sync + 'static>(
self,
service: T,
scope: Scope,
) -> Self
pub fn with_type_scope<T: Clone + Send + Sync + 'static>( self, service: T, scope: Scope, ) -> Self
按作用域注册服务(按类型)
Sourcepub fn with_config<T: Clone + Send + Sync + 'static>(self, config: T) -> Self
pub fn with_config<T: Clone + Send + Sync + 'static>(self, config: T) -> Self
注册配置服务(按类型)
Sourcepub fn with_config_scope<T: Clone + Send + Sync + 'static>(
self,
config: T,
scope: Scope,
) -> Self
pub fn with_config_scope<T: Clone + Send + Sync + 'static>( self, config: T, scope: Scope, ) -> Self
注册配置服务(按类型和作用域)
Sourcepub fn with_auth_scope<T: Clone + Send + Sync + 'static>(
self,
auth: T,
scope: Scope,
) -> Self
pub fn with_auth_scope<T: Clone + Send + Sync + 'static>( self, auth: T, scope: Scope, ) -> Self
注册认证服务(按类型和作用域)
Sourcepub fn build(self) -> Arc<Dependencies>
pub fn build(self) -> Arc<Dependencies>
构建依赖容器
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AlgebraicEffect
impl !RefUnwindSafe for AlgebraicEffect
impl Send for AlgebraicEffect
impl Sync for AlgebraicEffect
impl Unpin for AlgebraicEffect
impl UnsafeUnpin for AlgebraicEffect
impl !UnwindSafe for AlgebraicEffect
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