@@ -592,130 +592,12 @@ pub fn from_components(input: proc_macro::TokenStream) -> proc_macro::TokenStrea
592592#[ cfg( feature = "enabled" ) ]
593593#[ cfg( feature = "derive_component_model" ) ]
594594#[ proc_macro_derive( ComponentModel , attributes( debug, component) ) ]
595- pub fn component_model ( input : proc_macro:: TokenStream ) -> proc_macro:: TokenStream
595+ pub fn component_model ( input : proc_macro:: TokenStream ) -> proc_macro:: TokenStream
596596{
597597 let result = component:: component_model:: component_model ( input) ;
598- match result
598+ match result
599599 {
600600 Ok ( stream) => stream. into ( ) ,
601601 Err ( err) => err. to_compile_error ( ) . into ( ) ,
602602 }
603603}
604-
605- /// Unified derive macro that combines all component model functionality into a single annotation.
606- ///
607- /// The `ComponentModel` derive automatically generates implementations for:
608- /// - `Assign`: Basic component assignment with type-safe field setting
609- /// - `ComponentsAssign`: Multiple component assignment from tuples (when applicable)
610- /// - `ComponentFrom`: Create objects from single components (when applicable)
611- /// - `FromComponents`: Create objects from multiple components (when applicable)
612- ///
613- /// This eliminates the need to apply multiple individual derives and reduces boilerplate.
614- ///
615- /// # Features
616- ///
617- /// - Requires the `derive_component_model` feature to be enabled for use.
618- /// - Automatically detects which trait implementations are appropriate for the struct.
619- /// - Handles type conflicts gracefully by skipping conflicting implementations.
620- ///
621- /// # Attributes
622- ///
623- /// - `debug` : Optional attribute to enable debug-level output during macro expansion.
624- /// - `component` : Optional field-level attribute for customizing component behavior.
625- ///
626- /// # Examples
627- ///
628- /// ```rust
629- /// use component_model_meta::ComponentModel;
630- /// use component_model_types::Assign;
631- ///
632- /// #[ derive( Default, ComponentModel ) ]
633- /// struct Config
634- /// {
635- /// host : String,
636- /// port : i32,
637- /// enabled : bool,
638- /// }
639- ///
640- /// let mut config = Config::default();
641- ///
642- /// // Use Assign trait (auto-generated)
643- /// config.assign( "localhost".to_string() );
644- /// config.assign( 8080i32 );
645- /// config.enabled_set( true ); // Use field-specific method to avoid type ambiguity
646- ///
647- /// // Use fluent builder pattern (auto-generated)
648- /// let config2 = Config::default()
649- /// .impute( "api.example.com".to_string() )
650- /// .impute( 3000i32 )
651- /// .enabled_with( false ); // Use field-specific method to avoid type ambiguity
652- /// ```
653- #[ cfg( feature = "enabled" ) ]
654- #[ cfg( feature = "derive_component_model" ) ]
655- #[ proc_macro_derive( ComponentModel , attributes( debug, component) ) ]
656- pub fn component_model ( input : proc_macro:: TokenStream ) -> proc_macro:: TokenStream {
657- let result = component:: component_model:: component_model ( input) ;
658- match result {
659- Ok ( stream) => stream. into ( ) ,
660- Err ( err) => err. to_compile_error ( ) . into ( ) ,
661- }
662- }
663-
664- /// Unified derive macro that combines all component model functionality into a single annotation.
665- ///
666- /// The `ComponentModel` derive automatically generates implementations for:
667- /// - `Assign`: Basic component assignment with type-safe field setting
668- /// - `ComponentsAssign`: Multiple component assignment from tuples (when applicable)
669- /// - `ComponentFrom`: Create objects from single components (when applicable)
670- /// - `FromComponents`: Create objects from multiple components (when applicable)
671- ///
672- /// This eliminates the need to apply multiple individual derives and reduces boilerplate.
673- ///
674- /// # Features
675- ///
676- /// - Requires the `derive_component_model` feature to be enabled for use.
677- /// - Automatically detects which trait implementations are appropriate for the struct.
678- /// - Handles type conflicts gracefully by skipping conflicting implementations.
679- ///
680- /// # Attributes
681- ///
682- /// - `debug` : Optional attribute to enable debug-level output during macro expansion.
683- /// - `component` : Optional field-level attribute for customizing component behavior.
684- ///
685- /// # Examples
686- ///
687- /// ```rust
688- /// use component_model_meta::ComponentModel;
689- /// use component_model_types::Assign;
690- ///
691- /// #[ derive( Default, ComponentModel ) ]
692- /// struct Config
693- /// {
694- /// host : String,
695- /// port : i32,
696- /// enabled : bool,
697- /// }
698- ///
699- /// let mut config = Config::default();
700- ///
701- /// // Use Assign trait (auto-generated)
702- /// config.assign( "localhost".to_string() );
703- /// config.assign( 8080i32 );
704- /// config.enabled_set( true ); // Use field-specific method to avoid type ambiguity
705- ///
706- /// // Use fluent builder pattern (auto-generated)
707- /// let config2 = Config::default()
708- /// .impute( "api.example.com".to_string() )
709- /// .impute( 3000i32 )
710- /// .enabled_with( false ); // Use field-specific method to avoid type ambiguity
711- /// ```
712- #[ cfg( feature = "enabled" ) ]
713- #[ cfg( feature = "derive_component_model" ) ]
714- #[ proc_macro_derive( ComponentModel , attributes( debug, component) ) ]
715- pub fn component_model ( input : proc_macro:: TokenStream ) -> proc_macro:: TokenStream {
716- let result = component:: component_model:: component_model ( input) ;
717- match result {
718- Ok ( stream) => stream. into ( ) ,
719- Err ( err) => err. to_compile_error ( ) . into ( ) ,
720- }
721- }
0 commit comments