combine_traits 0.1.2

A Macro to create Traits wich are just a combination of existing ones.
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 3.98 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.01 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • oxydemeton/combine_traits
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • oxydemeton

combine_traits macro for rust

A combine_traits! is a single macro wich can be used to declare a new trait wich is no more than a combination of existing traits.

How to use

To create a new Trait call the macro combine_traits! with the name as the first argument. After a ; list all "sub_traits" seperated by ,.

Example:

use combine_traits::combine_traits;
use std::fmt::{Display, Debug};
combine_traits!(DisplayAndDebug; Display, Debug);
 
fn display_vs_debug<T: DisplayAndDebug>(x: T)->String {
    format!("Display:{}Debug:{:?}", x, x) }
assert_eq!(display_vs_debug(10), "Display:10Debug:10");