# Module :: derive_tools
<!--{ generate.module_header{} }-->
[](https://github.com/emersion/stability-badges#experimental) [](https://github.com/Wandalen/wTools/actions/workflows/ModuleDeriveToolsPush.yml) [](https://docs.rs/derive_tools) [](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=sample%2Frust%2Fderive_tools_trivial_sample%2Fsrc%2Fmain.rs,RUN_POSTFIX=--example%20derive_tools_trivial_sample/https://github.com/Wandalen/wTools) [](https://discord.gg/m3YfbXpUUY)
Collection of derives which extend STD.
<!--{ generate.module_header.end }-->
### Basic use-case
<!-- {{# generate.module_sample{} #}} -->
```rust
# #[ cfg( all( feature = "derive_from", feature = "derive_inner_from", feature = "derive_display", feature = "derive_from_str" ) ) ]
{
use derive_tools::*;
#[ derive( From, InnerFrom, Display, FromStr, PartialEq, Debug ) ]
#[ display( "{a}-{b}" ) ]
struct Struct1
{
a : i32,
b : i32,
}
// derived InnerFrom
let src = Struct1 { a : 1, b : 3 };
let got : ( i32, i32 ) = src.into();
let exp = ( 1, 3 );
assert_eq!( got, exp );
// derived From
let src : Struct1 = ( 1, 3 ).into();
let got : ( i32, i32 ) = src.into();
let exp = ( 1, 3 );
assert_eq!( got, exp );
// derived Display
let src = Struct1 { a : 1, b : 3 };
let got = format!( "{}", src );
let exp = "1-3";
println!( "{}", got );
assert_eq!( got, exp );
// derived FromStr
use std::str::FromStr;
let src = Struct1::from_str( "1-3" );
let exp = Ok( Struct1 { a : 1, b : 3 } );
assert_eq!( src, exp );
}
```
### To add to your project
```sh
cargo add derive_tools
```
### Try out from the repository
```sh
git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/derive_tools_trivial
cargo run
```