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§

source

fn add_options<T: Default + 'static>(&mut self) -> OptionsBuilder<'_, T>

Registers an options type that will have all of its associated services registered.

source

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
source

fn add_options_with<T, F>(&mut self, factory: F) -> OptionsBuilder<'_, T>
where F: Fn(&ServiceProvider) -> Ref<dyn OptionsFactory<T>> + 'static,

Registers an options type that will have all of its associated services registered.

Arguments
  • factory - The function used to create the associated options factory
source

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,

Registers an options type that will have all of its associated services registered.

Arguments
  • name - The name associated with the options
  • factory - The function used to create the associated options factory
source

fn configure_options<T: Default + 'static, F>(&mut self, setup: F) -> &mut Self
where F: Fn(&mut T) + 'static,

Registers an action used to initialize a particular type of configuration options.

Arguments
  • setup - The setup action used to configure options.
source

fn configure_named_options<T: Default + 'static, F>( &mut self, name: impl AsRef<str>, setup: F ) -> &mut Self
where F: Fn(&mut T) + 'static,

Registers an action used to initialize a particular type of configuration options.

Arguments
  • name - The name associated with the options
  • setup - The setup action used to configure options
source

fn post_configure_options<T: Default + 'static, F>( &mut self, setup: F ) -> &mut Self
where F: Fn(&mut T) + 'static,

Registers an action used to initialize a particular type of configuration options.

Arguments
  • setup - The setup action used to configure options
source

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,

Registers an action used to initialize a particular type of configuration options.

Arguments
  • name - The name associated with the options
  • setup - The setup action used to configure options

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl OptionsServiceExtensions for ServiceCollection

source§

fn add_options<T: Default + 'static>(&mut self) -> OptionsBuilder<'_, T>

source§

fn add_named_options<T: Default + 'static>( &mut self, name: impl AsRef<str> ) -> OptionsBuilder<'_, T>

source§

fn add_options_with<T, F>(&mut self, factory: F) -> OptionsBuilder<'_, T>
where F: Fn(&ServiceProvider) -> Ref<dyn OptionsFactory<T>> + 'static,

source§

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,

source§

fn configure_options<T: Default + 'static, F>(&mut self, setup: F) -> &mut Self
where F: Fn(&mut T) + 'static,

source§

fn configure_named_options<T: Default + 'static, F>( &mut self, name: impl AsRef<str>, setup: F ) -> &mut Self
where F: Fn(&mut T) + 'static,

source§

fn post_configure_options<T: Default + 'static, F>( &mut self, setup: F ) -> &mut Self
where F: Fn(&mut T) + 'static,

source§

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,

Implementors§