Struct options::OptionsBuilder
source · pub struct OptionsBuilder<'a, T: 'static> { /* private fields */ }
di
only.Expand description
Represents a builder used to configure Options
.
Implementations§
source§impl<'a, T: 'static> OptionsBuilder<'a, T>
impl<'a, T: 'static> OptionsBuilder<'a, T>
sourcepub fn new(services: &'a mut ServiceCollection, name: Option<&str>) -> Self
pub fn new(services: &'a mut ServiceCollection, name: Option<&str>) -> Self
Initializes a new options builder.
Arguments
services
- The associated collection of servicesname
- The optional name associated with the options
sourcepub fn services(&mut self) -> &mut ServiceCollection
pub fn services(&mut self) -> &mut ServiceCollection
Gets the associated collection of services
sourcepub fn configure1<F, D>(self, setup: F) -> Self
pub fn configure1<F, D>(self, setup: F) -> Self
sourcepub fn configure2<F, D1, D2>(self, setup: F) -> Self
pub fn configure2<F, D1, D2>(self, setup: F) -> Self
sourcepub fn configure3<F, D1, D2, D3>(self, setup: F) -> Self
pub fn configure3<F, D1, D2, D3>(self, setup: F) -> Self
sourcepub fn configure4<F, D1, D2, D3, D4>(self, setup: F) -> Self
pub fn configure4<F, D1, D2, D3, D4>(self, setup: F) -> Self
sourcepub fn configure5<F, D1, D2, D3, D4, D5>(self, setup: F) -> Self
pub fn configure5<F, D1, D2, D3, D4, D5>(self, setup: F) -> Self
sourcepub fn post_configure<F>(self, setup: F) -> Self
pub fn post_configure<F>(self, setup: F) -> Self
sourcepub fn post_configure1<F, D>(self, setup: F) -> Self
pub fn post_configure1<F, D>(self, setup: F) -> Self
sourcepub fn post_configure2<F, D1, D2>(self, setup: F) -> Self
pub fn post_configure2<F, D1, D2>(self, setup: F) -> Self
sourcepub fn post_configure3<F, D1, D2, D3>(self, setup: F) -> Self
pub fn post_configure3<F, D1, D2, D3>(self, setup: F) -> Self
sourcepub fn post_configure4<F, D1, D2, D3, D4>(self, setup: F) -> Self
pub fn post_configure4<F, D1, D2, D3, D4>(self, setup: F) -> Self
sourcepub fn post_configure5<F, D1, D2, D3, D4, D5>(self, setup: F) -> Self
pub fn post_configure5<F, D1, D2, D3, D4, D5>(self, setup: F) -> Self
Methods from Deref<Target = ServiceCollection>§
sourcepub fn remove(&mut self, index: usize) -> ServiceDescriptor
pub fn remove(&mut self, index: usize) -> ServiceDescriptor
sourcepub fn add<T>(&mut self, descriptor: T) -> &mut ServiceCollectionwhere
T: Into<ServiceDescriptor>,
pub fn add<T>(&mut self, descriptor: T) -> &mut ServiceCollectionwhere
T: Into<ServiceDescriptor>,
Adds a service using the specified service descriptor.
Arguments
descriptor
- TheServiceDescriptor
to register
sourcepub fn try_add<T>(&mut self, descriptor: T) -> &mut ServiceCollectionwhere
T: Into<ServiceDescriptor>,
pub fn try_add<T>(&mut self, descriptor: T) -> &mut ServiceCollectionwhere
T: Into<ServiceDescriptor>,
Adds a service using the specified service descriptor if the service has not already been registered.
Arguments
descriptor
- TheServiceDescriptor
to register
sourcepub fn try_add_to_all<T>(&mut self, descriptor: T) -> &mut ServiceCollectionwhere
T: Into<ServiceDescriptor>,
pub fn try_add_to_all<T>(&mut self, descriptor: T) -> &mut ServiceCollectionwhere
T: Into<ServiceDescriptor>,
Adds a service using the specified service descriptor if the service with same service and implementation type has not already been registered.
Arguments
descriptor
- TheServiceDescriptor
to register
sourcepub fn try_add_all(
&mut self,
descriptors: impl IntoIterator<Item = ServiceDescriptor>
) -> &mut ServiceCollection
pub fn try_add_all( &mut self, descriptors: impl IntoIterator<Item = ServiceDescriptor> ) -> &mut ServiceCollection
Adds the specified service descriptors if each of the services are not already registered with the same service and implementation type.
Arguments
descriptors
- TheServiceDescriptor
sequence to register
sourcepub fn replace<T>(&mut self, descriptor: T) -> &mut ServiceCollectionwhere
T: Into<ServiceDescriptor>,
pub fn replace<T>(&mut self, descriptor: T) -> &mut ServiceCollectionwhere
T: Into<ServiceDescriptor>,
Removes the first service descriptor with the same service type and adds the replacement.
Arguments
descriptor
- The replacementServiceDescriptor
sourcepub fn try_replace<T>(&mut self, descriptor: T) -> &mut ServiceCollectionwhere
T: Into<ServiceDescriptor>,
pub fn try_replace<T>(&mut self, descriptor: T) -> &mut ServiceCollectionwhere
T: Into<ServiceDescriptor>,
Adds or replaces a service with the specified descriptor if the service has not already been registered.
Arguments
descriptor
- The replacementServiceDescriptor
sourcepub fn remove_all<T>(&mut self) -> &mut ServiceCollection
pub fn remove_all<T>(&mut self) -> &mut ServiceCollection
Removes all specified descriptors of the specified type.
sourcepub fn build_provider(&self) -> Result<ServiceProvider, ValidationError>
pub fn build_provider(&self) -> Result<ServiceProvider, ValidationError>
Builds and returns a new ServiceProvider
.
sourcepub fn iter(
&self
) -> impl Iterator<Item = &ServiceDescriptor> + ExactSizeIterator + DoubleEndedIterator
pub fn iter( &self ) -> impl Iterator<Item = &ServiceDescriptor> + ExactSizeIterator + DoubleEndedIterator
Gets a read-only iterator for the collection