Trait options::ext::OptionsServiceExtensions
source · pub trait OptionsServiceExtensions {
// Required methods
fn add_options<T: Default + 'static>(&mut self) -> OptionsBuilder<'_, T>;
fn add_named_options<T: Default + 'static>(
&mut self,
name: impl AsRef<str>
) -> OptionsBuilder<'_, T>;
fn add_options_with<T, F>(&mut self, factory: F) -> OptionsBuilder<'_, T>
where F: Fn(&ServiceProvider) -> Ref<dyn OptionsFactory<T>> + 'static;
fn add_named_options_with<T, F>(
&mut self,
name: impl AsRef<str>,
factory: F
) -> OptionsBuilder<'_, T>
where F: Fn(&ServiceProvider) -> Ref<dyn OptionsFactory<T>> + 'static;
fn configure_options<T: Default + 'static, F>(
&mut self,
setup: F
) -> &mut Self
where F: Fn(&mut T) + 'static;
fn configure_named_options<T: Default + 'static, F>(
&mut self,
name: impl AsRef<str>,
setup: F
) -> &mut Self
where F: Fn(&mut T) + 'static;
fn post_configure_options<T: Default + 'static, F>(
&mut self,
setup: F
) -> &mut Self
where F: Fn(&mut T) + 'static;
fn post_configure_named_options<T: Default + 'static, F>(
&mut self,
name: impl AsRef<str>,
setup: F
) -> &mut Self
where F: Fn(&mut T) + 'static;
}
Available on crate feature
di
only.Expand description
Defines extension methods for the ServiceCollection
struct.
Required Methods§
sourcefn add_options<T: Default + 'static>(&mut self) -> OptionsBuilder<'_, T>
fn add_options<T: Default + 'static>(&mut self) -> OptionsBuilder<'_, T>
Registers an options type that will have all of its associated services registered.
sourcefn add_named_options<T: Default + 'static>(
&mut self,
name: impl AsRef<str>
) -> OptionsBuilder<'_, T>
fn add_named_options<T: Default + 'static>( &mut self, name: impl AsRef<str> ) -> OptionsBuilder<'_, T>
Registers an options type that will have all of its associated services registered.
Arguments
name
- The name associated with the options
sourcefn add_options_with<T, F>(&mut self, factory: F) -> OptionsBuilder<'_, T>
fn add_options_with<T, F>(&mut self, factory: F) -> OptionsBuilder<'_, T>
Registers an options type that will have all of its associated services registered.
Arguments
factory
- The function used to create the associated options factory
sourcefn add_named_options_with<T, F>(
&mut self,
name: impl AsRef<str>,
factory: F
) -> OptionsBuilder<'_, T>
fn add_named_options_with<T, F>( &mut self, name: impl AsRef<str>, factory: F ) -> OptionsBuilder<'_, T>
Registers an options type that will have all of its associated services registered.
Arguments
name
- The name associated with the optionsfactory
- The function used to create the associated options factory
sourcefn configure_options<T: Default + 'static, F>(&mut self, setup: F) -> &mut Self
fn configure_options<T: Default + 'static, F>(&mut self, setup: F) -> &mut Self
Registers an action used to initialize a particular type of configuration options.
Arguments
setup
- The setup action used to configure options.
sourcefn configure_named_options<T: Default + 'static, F>(
&mut self,
name: impl AsRef<str>,
setup: F
) -> &mut Self
fn configure_named_options<T: Default + 'static, F>( &mut self, name: impl AsRef<str>, setup: F ) -> &mut Self
Registers an action used to initialize a particular type of configuration options.
Arguments
name
- The name associated with the optionssetup
- The setup action used to configure options
sourcefn post_configure_options<T: Default + 'static, F>(
&mut self,
setup: F
) -> &mut Self
fn post_configure_options<T: Default + 'static, F>( &mut self, setup: F ) -> &mut Self
Registers an action used to initialize a particular type of configuration options.
Arguments
setup
- The setup action used to configure options
sourcefn post_configure_named_options<T: Default + 'static, F>(
&mut self,
name: impl AsRef<str>,
setup: F
) -> &mut Self
fn post_configure_named_options<T: Default + 'static, F>( &mut self, name: impl AsRef<str>, setup: F ) -> &mut Self
Registers an action used to initialize a particular type of configuration options.
Arguments
name
- The name associated with the optionssetup
- The setup action used to configure options
Object Safety§
This trait is not object safe.