#[derive(ComponentModel)]
{
    // Attributes available to this derive:
    #[debug]
    #[component]
}
Expand description
Unified derive macro that combines all component model functionality into a single annotation.
The ComponentModel derive automatically generates implementations for:
- Assign: Basic component assignment with type-safe field setting
- ComponentsAssign: Multiple component assignment from tuples (when applicable)
- ComponentFrom: Create objects from single components (when applicable)
- FromComponents: Create objects from multiple components (when applicable)
This eliminates the need to apply multiple individual derives and reduces boilerplate.
§Features
- Requires the derive_component_modelfeature to be enabled for use.
- Automatically detects which trait implementations are appropriate for the struct.
- Handles type conflicts gracefully by skipping conflicting implementations.
§Attributes
- debug: Optional attribute to enable debug-level output during macro expansion.
- component: Optional field-level attribute for customizing component behavior.
§Examples
use component_model_meta::ComponentModel;
use component_model_types::Assign;
 
#[ derive( Default, ComponentModel ) ]
struct Config
{
  host : String,
  port : i32,
  enabled : bool,
}
 
let mut config = Config::default();
 
// Use Assign trait (auto-generated)
config.assign( "localhost".to_string() );
config.assign( 8080i32 );
config.enabled_set( true ); // Use field-specific method to avoid type ambiguity
 
// Use fluent builder pattern (auto-generated)
let config2 = Config::default()
  .impute( "api.example.com".to_string() )
  .impute( 3000i32 )
  .enabled_with( false ); // Use field-specific method to avoid type ambiguity