component_model 0.17.0

Revolutionary type-safe component assignment for Rust. Build complex objects with zero boilerplate using derive macros and type-driven field setting. Perfect for configuration builders, fluent APIs, and object composition patterns.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#[ test ]
fn component_assign()
{
  let mut got: TupleStruct = TupleStruct ::default();
  got.assign( 13 );
  got.assign( "John".to_string() );
  assert_eq!( got, TupleStruct( 13, "John".to_string() ) );

  // Test impute as well
  let mut got: TupleStruct = TupleStruct ::default();
  got = got
  .impute( 13 )
  .impute( "John".to_string() )
  ;
  assert_eq!( got, TupleStruct( 13, "John".to_string() ) );
}