pub trait OptionsServiceExtensions {
// Required methods
fn add_options<T: Value + Default + 'static>(
&mut self,
) -> OptionsBuilder<'_, T>;
fn add_named_options<T: Value + Default + 'static>(
&mut self,
name: impl AsRef<str>,
) -> OptionsBuilder<'_, T>;
fn add_options_with<T, F>(&mut self, factory: F) -> OptionsBuilder<'_, T>
where T: Value,
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 T: Value,
F: Fn(&ServiceProvider) -> Ref<dyn OptionsFactory<T>> + 'static;
fn configure_options<T, F>(&mut self, setup: F) -> &mut Self
where T: Value + Default + 'static,
F: Fn(&mut T) + 'static;
fn configure_named_options<T, F>(
&mut self,
name: impl AsRef<str>,
setup: F,
) -> &mut Self
where T: Value + Default + 'static,
F: Fn(&mut T) + 'static;
fn post_configure_options<T, F>(&mut self, setup: F) -> &mut Self
where T: Value + Default + 'static,
F: Fn(&mut T) + 'static;
fn post_configure_named_options<T, F>(
&mut self,
name: impl AsRef<str>,
setup: F,
) -> &mut Self
where T: Value + Default + 'static,
F: Fn(&mut T) + 'static;
}di only.Expand description
Defines extension methods for the ServiceCollection struct.
Required Methods§
Sourcefn add_options<T: Value + Default + 'static>(&mut self) -> OptionsBuilder<'_, T>
fn add_options<T: Value + Default + 'static>(&mut self) -> OptionsBuilder<'_, T>
Registers an options type that will have all of its associated services registered.
Sourcefn add_named_options<T: Value + Default + 'static>(
&mut self,
name: impl AsRef<str>,
) -> OptionsBuilder<'_, T>
fn add_named_options<T: Value + 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, F>(&mut self, setup: F) -> &mut Self
fn configure_options<T, 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, F>(
&mut self,
name: impl AsRef<str>,
setup: F,
) -> &mut Self
fn configure_named_options<T, 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, F>(&mut self, setup: F) -> &mut Self
fn post_configure_options<T, 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, F>(
&mut self,
name: impl AsRef<str>,
setup: F,
) -> &mut Self
fn post_configure_named_options<T, 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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.