<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Cradicle Explorer</title>
    <link href="/css/bootstrap/bootstrap.min.css" rel="stylesheet">
    <style>
      .form-control-dark::placeholder {
          color: #aaa;
          opacity: 1;
      }
    </style>
    <link rel="stylesheet" href="/assets/fontawesome/css/all.min.css">
    <link rel="icon" type="image/png" href="/favicon.png">


                <link href="/css/dashboard.css" rel="stylesheet">
                </head>
                <body>
                <header class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
                  <a class="navbar-brand col-md-3 col-lg-2 me-0 px-3 fs-6" href="/">Cradicle Explorer</a>
                  <button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                  </button>
                  <form method="get" action="/cgi-bin/main" style="width:100%;"><input class="form-control form-control-dark w-100 rounded-0 border-0" type="text" name="q" placeholder="Search repos" aria-label="Search"></form>
                  <div class="navbar-nav flex-row">
                    <div class="nav-item text-nowrap">
                      <a class="nav-link px-3 active" href="/cgi-bin/repo?id=z2yykR9q4FzuakvYrcuM18XijZjTE">code-product</a>
                    </div>
                  </div>
                </header>
                <div class="container-fluid">
                  <div class="row">
                    <nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-dark sidebar collapse">
                      <div class="position-sticky pt-3 sidebar-sticky">
                        <ul class="nav flex-column">
                          <li class="nav-item">
                            <a class="nav-link active" href="/cgi-bin/repo?id=z2yykR9q4FzuakvYrcuM18XijZjTE">
                              <i class="align-text-bottom fa-solid fa-info"></i>
                              Info
                            </a>
                          </li>
                          <li class="nav-item">
                            <a class="nav-link" href="/cgi-bin/repo?id=z2yykR9q4FzuakvYrcuM18XijZjTE&issue=list">
                              <i class="align-text-bottom fa-solid fa-layer-group"></i>
                              Issues
                            </a>
                          </li>
                          <li class="nav-item">
                            <a class="nav-link" href="/cgi-bin/repo?id=z2yykR9q4FzuakvYrcuM18XijZjTE&patch=list">
                              <i class="align-text-bottom fa-solid fa-vest-patches"></i>
                              Patches
                            </a>
                          </li>
                          <li class="nav-item">
                            <a class="nav-link" href="/cgi-bin/repo?id=z2yykR9q4FzuakvYrcuM18XijZjTE&wallet=list">
                              <i class="align-text-bottom fa-solid fa-wallet"></i>
                              Wallets
                            </a>
                          </li>
                          <li class="nav-item">
                            <a class="nav-link" href="/cgi-bin/repo?id=z2yykR9q4FzuakvYrcuM18XijZjTE&source=.">
                              <i class="align-text-bottom fa-solid fa-code"></i>
                              Source
                            </a>
                          </li>
                        <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted text-uppercase">
                          <span></span>
                        </h6>
                        <ul class="nav flex-column mb-2">
                        
                        </ul>
                      </div>
                    </nav>
                <main class="col-md-9 ms-sm-auto col-lg-10">
                  <div class="container px-1 py-3">
        

    <div class="list-group">
    <div class="list-group-item">
    <div style="font-size:1.3rem;">code-product</div>
    <div class="repo-item"></div>
    <div>rad:z2yykR9q4FzuakvYrcuM18XijZjTE</div>
    </div>
    <div class="list-group-item">
    <div>Visibility</div>
    <div class="repo-item">public</div>
    </div>
    <div class="list-group-item">
    <div>Delegates</div><div class="repo-item">did:key:z6MksaJkZuQj49mbrft8JNvo3vBDU5AC5owW1EnCZJJ3goRX</div>
    </div>
    <div class="list-group-item">
    <div>Default branch</div>
    <div><span class="repo-item">master &#8594 366d5f7df83f5b62cb133c7afa000002cf77e9c5</span> (Tue Dec 31 22:11:52 2024)</div>
    </div>
    <div class="list-group-item">
    <div>Threshold</div>
    <div class="repo-item">1</div>
    </div>
    </div>
    
        <div class="list-group mt-3">
        <div class="list-group-item">
        <div class="mb-2" style="font-weight:bold;"><i class="fa-solid fa-book"></i> README.md</div>
        <pre style="margin:0; font-size:0.85rem; overflow-x:auto; color:#fafafa;"># Obsoletion Notice


*** This crate is superseded by the xmacro/xmacro_lib crate ***

* Migrate your projects to xmacros.
* Don&#x27;t use it for new Code.


# Code Product

This crate provides two things:
 1. A [library](code_product_lib) to generate code by repetively expanding macros.  This is
    the primary objective of this crate as it enables code generation in a convenient way from
    other proc macros. The Syntax is there as well.
 2. The standalone [`product!{}`](product) and [`product_items!{}`](product_items) macros to
    generate code using the library as it is useful on its own.


## Use-Cases

This macro system is useful to generate boilerplate code that repeats in similar ways.


## Product expansion example

The name `product` is because it expands to the product (each by each) of all defined
sets. For example given are the two sets of defintions &#x27;Foo and Bar&#x27; and &#x27;This and That&#x27;,
showing different syntactic variants:

```rust
# use code_product::product;
# trait Trait&lt;T&gt;{}
# struct This&lt;T&gt;(T); struct That&lt;T&gt;(T);
# struct Foo; struct Bar;
product!{
    // Rather elaborate form with named definitions:
    // define `Type` to expand to `This` and `That`
    $(Type: (This) (That))
    // and inline define `T` to expand to `Foo` and `Bar`
    impl Trait&lt;$($T: (Foo)(Bar))&gt; for $Type&lt;$T&gt; {}
}
```

or

```rust
# use code_product::product;
# trait Trait&lt;T&gt;{}
# struct This&lt;T&gt;(T); struct That&lt;T&gt;(T);
# struct Foo; struct Bar;
product!{
    // Alternative form inlining definition and reference by index:
    impl Trait&lt;$((Foo)(Bar))&gt; for $((This)(That))&lt;$0&gt; {}
}
```

either of the above will expand four times to:

```rust
# trait Trait&lt;T&gt;{}
# struct This&lt;T&gt;(T); struct That&lt;T&gt;(T);
# struct Foo; struct Bar;
impl Trait&lt;Foo&gt; for This&lt;Foo&gt; {}
impl Trait&lt;Foo&gt; for That&lt;Foo&gt; {}
impl Trait&lt;Bar&gt; for This&lt;Bar&gt; {}
impl Trait&lt;Bar&gt; for That&lt;Bar&gt; {}
```

## Linear expansion example

In `linear` expansion scopes in square brackets each definition has to define the same number
of itens. These are then iterated together. This gives more control over the expansions as
each possible combination has to be defined manually.

Exmaple: Pair Substr with &amp;str and with CowStr and its reversed forms.

```text
product! {
    $[
        $(Lhs: (SubStr)(&amp;str)(SubStr)(CowStr))
        $(Rhs: (&amp;str)(SubStr)(CowStr)(SubStr))

        impl PartialOrd&lt;$Rhs&gt; for $Lhs {
            fn partial_cmp(&amp;self, other: &amp;$Rhs) -&gt; Option&lt;std::cmp::Ordering&gt; {
                (**self).partial_cmp(other)
            }
        }
    ]
}
```

</pre>
        </div>
        </div>

</div>
</main>
</div>
</div>


</body>
</html>

