Crate impls_index

Source
Expand description

§Module :: impls_index

experimental rust-status docs.rs Open in Gitpod discord

Several of macros to put each function under a named macro to index every function in a class.

It encourages writing better code, having index of components stripped of details of implementation is very important for comprehension of the code and ability to see the big picture.

§Basic use-case

use ::impls_index::*;

impls1!
{
  fn f1() -> i32
  {
    println!( "f1() : 13" );
    13
  }
};

index!
{
  f1,
}

assert_eq!( f1(), 13 );
/* print : f1() : 13 */

§To add to your project

cargo add impls_index_meta

§Try out from the repository

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

Re-exports§

pub use super::super::implsindex;

Modules§

dependency
Namespace with dependencies.
exposed
Exposed namespace of the module.
implsindex
Collection of general purpose meta tools.
orphan
Orphan namespace of the module.
own
Own namespace of the module.
prelude
Prelude to use essentials: use my_module::prelude::*.

Macros§

_impls_callback
Internal impls1 macro. Don’t use.
fn_name
Get name of a function.
fn_rename
Macro to rename function.
fns
Split functions.
fns2
Split functions.
impls
Macros to put each function under a named macro to index every function in a class.
impls1
Define implementation putting each function under a macro.
impls2
Define implementation putting each function under a macro.
impls3
Macros to put each function under a named macro to index every function in a class.
impls_optional
Define implementation putting each function under a macro. Use index! to generate code for each element. Unlike elements of impls_optional!, elements of [impls] are mandatory to be used in index!.
index
Index of items.
tests_impls
Define implementation putting each function under a macro and adding attribute #[ test ]. Use index! to generate code for each element. Unlike elements of [test_impls_optional!], elements of [test_impls] are mandatory to be used in index!.
tests_impls_optional
Define implementation putting each function under a macro and adding attribute #[ test ]. Use index! to generate code for each element. Unlike elements of [test_impls!], elements of [test_impls_optional] are optional to be used in index!.
tests_index
Index of items.