Skip to content

Commit

Permalink
Add sample impls_index_trivial_sample
Browse files Browse the repository at this point in the history
  • Loading branch information
dmvict committed Jun 9, 2022
1 parent dd3f3db commit 717cb64
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 4 deletions.
8 changes: 4 additions & 4 deletions module/rust/impls_index/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ path = "rust/test/meta/impls_index_tests.rs"
name = "impls_index_smoke_test"
path = "rust/test/_integration_test/smoke_test.rs"

# [[example]]
# name = "impls_index_trivial_sample"
# path = "sample/rust/impls_index_trivial_sample/src/main.rs"
# qqq : xxx : write please
[[example]]
name = "impls_index_trivial_sample"
path = "sample/rust/impls_index_trivial_sample/src/main.rs"
# qqq : xxx : write please # aaa : Dmytro : added

[dependencies]
impls_index_meta = { version = "~0.1", path = "../../rust/impls_index_meta" }
Expand Down
23 changes: 23 additions & 0 deletions module/rust/impls_index/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,29 @@ Several of macros to put each function under a named macro to index every functi

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.

### Sample

```rust
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

```sh
Expand Down
8 changes: 8 additions & 0 deletions sample/rust/impls_index_trivial_sample/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "impls_index_trivial_sample"
version = "0.0.0"
edition = "2021"
publish = false

[dependencies]
impls_index = { version = "*", path = "../../../module/rust/impls_index" }
5 changes: 5 additions & 0 deletions sample/rust/impls_index_trivial_sample/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Sample

[![discord](https://img.shields.io/discord/872391416519737405?color=eee&logo=discord&logoColor=eee&label=ask)](https://discord.gg/m3YfbXpUUY)
[![Open in Gitpod](https://raster.shields.io/static/v1?label=try&message=online&color=eee&logo=gitpod&logoColor=eee)](https://gitpod.io/#RUN_PATH=sample%2Frust%2Fimpls_index_trivial_sample,SAMPLE_FILE=.%2Fsrc%2Fmain.rs/https://github.com/Wandalen/wTools)
[![docs.rs](https://raster.shields.io/static/v1?label=docs&message=online&color=eee&logo=docsdotrs&logoColor=eee)](https://docs.rs/impls_index)
22 changes: 22 additions & 0 deletions sample/rust/impls_index_trivial_sample/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

fn main()
{
use ::impls_index::*;

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

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

0 comments on commit 717cb64

Please sign in to comment.