pub struct ServiceBindings { /* private fields */ }
Expand description
Collection of service bindings
Implementations§
Source§impl ServiceBindings
impl ServiceBindings
Sourcepub fn add_descriptor(&mut self, descriptor: ServiceDescriptor)
pub fn add_descriptor(&mut self, descriptor: ServiceDescriptor)
Add a service descriptor
Sourcepub fn descriptors(&self) -> &[ServiceDescriptor]
pub fn descriptors(&self) -> &[ServiceDescriptor]
Get all service descriptors
Sourcepub fn get_descriptor(
&self,
service_id: &ServiceId,
) -> Option<&ServiceDescriptor>
pub fn get_descriptor( &self, service_id: &ServiceId, ) -> Option<&ServiceDescriptor>
Get service descriptors by service ID
Sourcepub fn get_descriptor_named<T: 'static + ?Sized>(
&self,
name: &str,
) -> Option<&ServiceDescriptor>
pub fn get_descriptor_named<T: 'static + ?Sized>( &self, name: &str, ) -> Option<&ServiceDescriptor>
Get service descriptor by type and name without allocation
Sourcepub fn service_ids(&self) -> Vec<ServiceId>
pub fn service_ids(&self) -> Vec<ServiceId>
Get all service IDs
Sourcepub fn contains_named<T: 'static + ?Sized>(&self, name: &str) -> bool
pub fn contains_named<T: 'static + ?Sized>(&self, name: &str) -> bool
Check if a named service is registered without allocation
Sourcepub fn into_descriptors(self) -> Vec<ServiceDescriptor>
pub fn into_descriptors(self) -> Vec<ServiceDescriptor>
Consume self and return all descriptors
Trait Implementations§
Source§impl Debug for ServiceBindings
impl Debug for ServiceBindings
Source§impl Default for ServiceBindings
impl Default for ServiceBindings
Source§impl ServiceBinder for ServiceBindings
impl ServiceBinder for ServiceBindings
Source§fn add_service_descriptor(
&mut self,
descriptor: ServiceDescriptor,
) -> Result<&mut Self, CoreError>
fn add_service_descriptor( &mut self, descriptor: ServiceDescriptor, ) -> Result<&mut Self, CoreError>
Add a pre-built service descriptor
Source§fn bind<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>(
&mut self,
) -> &mut Self
fn bind<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>( &mut self, ) -> &mut Self
Bind an interface to an implementation
Source§fn bind_singleton<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>(
&mut self,
) -> &mut Self
fn bind_singleton<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>( &mut self, ) -> &mut Self
Bind an interface to an implementation with singleton lifetime
Source§fn bind_transient<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>(
&mut self,
) -> &mut Self
fn bind_transient<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>( &mut self, ) -> &mut Self
Bind an interface to an implementation with transient lifetime
Source§fn bind_factory<TInterface: ?Sized + 'static, F, T>(
&mut self,
factory: F,
) -> &mut Self
fn bind_factory<TInterface: ?Sized + 'static, F, T>( &mut self, factory: F, ) -> &mut Self
Bind a service using a factory function
Source§fn bind_instance<TInterface: ?Sized + 'static, TImpl: Send + Sync + Clone + 'static>(
&mut self,
instance: TImpl,
) -> &mut Self
fn bind_instance<TInterface: ?Sized + 'static, TImpl: Send + Sync + Clone + 'static>( &mut self, instance: TImpl, ) -> &mut Self
Bind a pre-created instance
Source§fn bind_named<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>(
&mut self,
name: &str,
) -> &mut Self
fn bind_named<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>( &mut self, name: &str, ) -> &mut Self
Bind a named service
Source§fn bind_injectable<T: Injectable>(&mut self) -> &mut Self
fn bind_injectable<T: Injectable>(&mut self) -> &mut Self
Bind an Injectable service with auto-wiring
Source§fn bind_injectable_singleton<T: Injectable>(&mut self) -> &mut Self
fn bind_injectable_singleton<T: Injectable>(&mut self) -> &mut Self
Bind an Injectable service as singleton with auto-wiring
Source§fn bind_with<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>(
&mut self,
) -> AdvancedBindingBuilder<TInterface>
fn bind_with<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>( &mut self, ) -> AdvancedBindingBuilder<TInterface>
Advanced bind with fluent configuration - returns builder for chaining
Source§fn with_implementation<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>(
&mut self,
config: BindingConfig,
) -> &mut Self
fn with_implementation<TInterface: ?Sized + 'static, TImpl: Send + Sync + Default + 'static>( &mut self, config: BindingConfig, ) -> &mut Self
Complete advanced binding with implementation
Source§fn bind_lazy<TInterface: ?Sized + 'static, F, T>(
&mut self,
factory: F,
) -> &mut Self
fn bind_lazy<TInterface: ?Sized + 'static, F, T>( &mut self, factory: F, ) -> &mut Self
Bind a lazy service using factory that gets called only when needed
Source§fn bind_parameterized_factory<TInterface: ?Sized + 'static, P, F, T>(
&mut self,
_factory: F,
) -> &mut Self
fn bind_parameterized_factory<TInterface: ?Sized + 'static, P, F, T>( &mut self, _factory: F, ) -> &mut Self
Bind with parameterized factory
Source§fn bind_collection<TInterface: ?Sized + 'static, F>(
&mut self,
configure: F,
) -> &mut Selfwhere
F: FnOnce(&mut CollectionBindingBuilder<TInterface>),
fn bind_collection<TInterface: ?Sized + 'static, F>(
&mut self,
configure: F,
) -> &mut Selfwhere
F: FnOnce(&mut CollectionBindingBuilder<TInterface>),
Bind a collection of services using a closure-based configuration
Auto Trait Implementations§
impl Freeze for ServiceBindings
impl !RefUnwindSafe for ServiceBindings
impl Send for ServiceBindings
impl Sync for ServiceBindings
impl Unpin for ServiceBindings
impl !UnwindSafe for ServiceBindings
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