pub trait OptionsExt {
// Required methods
fn add_options<T: Value + Default + 'static>(&mut self) -> Builder<'_, T>;
fn add_named_options<T: Value + Default + 'static>(
&mut self,
name: impl AsRef<str>,
) -> Builder<'_, T>;
fn add_options_with<T, F>(&mut self, factory: F) -> Builder<'_, T>
where T: Value,
F: Fn(&ServiceProvider) -> Ref<dyn Factory<T>> + 'static;
fn add_named_options_with<T, F>(
&mut self,
name: impl AsRef<str>,
factory: F,
) -> Builder<'_, T>
where T: Value,
F: Fn(&ServiceProvider) -> Ref<dyn Factory<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;
}Available on crate feature
di only.Expand description
Defines extension methods for the ServiceCollection struct.
Required Methods§
Sourcefn add_options<T: Value + Default + 'static>(&mut self) -> Builder<'_, T>
fn add_options<T: Value + Default + 'static>(&mut self) -> Builder<'_, 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>,
) -> Builder<'_, T>
fn add_named_options<T: Value + Default + 'static>( &mut self, name: impl AsRef<str>, ) -> Builder<'_, T>
Sourcefn add_options_with<T, F>(&mut self, factory: F) -> Builder<'_, T>
fn add_options_with<T, F>(&mut self, factory: F) -> Builder<'_, 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,
) -> Builder<'_, T>
fn add_named_options_with<T, F>( &mut self, name: impl AsRef<str>, factory: F, ) -> Builder<'_, T>
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
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
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.
Implementations on Foreign Types§
Source§impl OptionsExt for ServiceCollection
Available on crate features di or cfg only.
impl OptionsExt for ServiceCollection
Available on crate features
di or cfg only.