Thanks to visit codestin.com
Credit goes to lib.rs

#general-purpose #macro-derive #enhance

no-std derive_tools

A collection of derive macros designed to enhance STD

56 breaking releases

0.58.0 Dec 19, 2025
0.57.0 Nov 24, 2025
0.56.0 Nov 13, 2025
0.39.0 Jul 31, 2025
0.1.5 Jul 15, 2022

#678 in Rust patterns

Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App

785 downloads per month
Used in 107 crates (16 directly)

MIT license

125KB
1.5K SLoC

Module :: derive_tools

experimental rust-status docs.rs Open in Gitpod discord

Basic use-case

# #[ cfg( all( feature = "derive_from", feature = "derive_display", feature = "derive_from_str" ) ) ]
{
  use derive_tools::*;

  #[ derive( From, Display, FromStr, PartialEq, Debug ) ]
  #[ display( "{0}" ) ]
  struct Struct1( i32 );

  // derived From
  let src : Struct1 = 42.into();
  let exp = Struct1( 42 );
  assert_eq!( src, exp );

  // derived Display
  let src = Struct1( 42 );
  let got = format!( "{}", src );
  let exp = "42";
  println!( "{}", got );
  assert_eq!( got, exp );

  // derived FromStr  
  use std::str::FromStr;
  let src = Struct1::from_str( "42" );
  let exp = Ok( Struct1( 42 ) );
  assert_eq!( src, exp );

}

To add to your project

cargo add derive_tools

Try out from the repository

git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/derive_tools_trivial
cargo run

Dependencies

~0–1MB
~15K SLoC