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
#[ test ]
fn component_from()
{
  let t1 = TupleStruct( 42, "Hello".to_string() );

  // Test converting to i32
  let got_i32: i32 = ( &t1 ).into();
  let exp_i32: i32 = 42;
  assert_eq!( got_i32, exp_i32 );

  // Test converting to String
  let got_string: String = ( &t1 ).into();
  let exp_string: String = "Hello".to_string();
  assert_eq!( got_string, exp_string );
}