1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
#![ warn( missing_docs ) ]
//!
//! Module::instance_of with macro `instance_of` to answer the question: does it implement a trait?
//!
// #[ macro_use ]
mod implements_impl;
///
/// Macro `implements` to answer the question: does it implement a trait?
///
/// # Example
/// ```
/// use implements::implements;
///
/// dbg!( implements!( 13_i32 => Copy ) );
/// // < implements!( 13_i32 => Copy ) : true
/// dbg!( implements!( Box::new( 13_i32 ) => Copy ) );
/// // < implements!( 13_i32 => Copy ) : false
/// ```
#[ macro_export ]
macro_rules! implements
{
( $( $arg : tt )+ ) =>
{
$crate::_implements!( $( $arg )+ );
}
}
///
/// Macro `instance_of` to answer the question: does it implement a trait? Alias of the macro `implements`.
///
/// # Example
/// ```
/// use implements::instance_of;
///
/// dbg!( instance_of!( 13_i32 => Copy ) );
/// // < instance_of!( 13_i32 => Copy ) : true
/// dbg!( instance_of!( Box::new( 13_i32 ) => Copy ) );
/// // < instance_of!( 13_i32 => Copy ) : false
/// ```
#[ macro_export ]
macro_rules! instance_of
{
( $( $arg : tt )+ ) =>
{
$crate::_implements!( $( $arg )+ );
}
}