Skip to content

Commit

Permalink
Fix README.md rendering on GH
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhenrymantilla committed Jan 30, 2022
1 parent 9729685 commit 47f4e55
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "higher-order-closure"
authors = [
"Daniel Henry-Mantilla <[email protected]>"
]
version = "0.0.1"
version = "0.0.2" # Keep in sync
edition = "2018"

license = "Zlib OR MIT OR Apache-2.0"
Expand Down
42 changes: 28 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,34 @@ nested function or type definitions).
In order to make them available, `higher_order_signature!` accepts an initial
optional `#![with<simple generics…>]` parameter (or even
`#![with<simple generics…> where clauses…]` if the "simple shape"
restrictions[^2] for the generic parameters are too restrictive).
restrictions for the generic parameters are too restrictive).

<details><summary>"simple shaped" generics macro restrictions</summary>

The generics parameters inside `#![with<…>]` have to be of the form:

```rust ,ignore
<
'a, 'b : 'a, ...
T, U : ?Sized + 'a + ::core::fmt::Debug, V, ...
>
```

Mainly:

- at most one super-lifetime bound on each lifetime,

- the super-bounds on the types must be exactly of the form:
1. optional `?Sized`,
1. followed by an optional lifetime bound,
1. followed by an optional trait bound.
1. And nothing more.
If you need more versatility, use the `where` clauses.

In practice, however, the bounds are seldom needed, since such generics are only
used for the _signature_ of the closure, not its body / implementation.

</details>


```rust
Expand Down Expand Up @@ -319,17 +346,4 @@ higher-order signatures embedded as `Fn` bounds on its parameters, thus making
it act as a "funnel" that only lets closure with the right signature pass
through).

[^2]: those generics have to be of the form:
```rust ,ignore
<
'a, 'b : 'a, ...
T, U : ?Sized + 'a + ::core::fmt::Debug, V, ...
>
```
Mainly, at most one super-lifetime bound on each lifetime, and the super-bounds
on the types must be exactly of the form: optional `?Sized`, followed by an
optional lifetime bound, followed by an optional trait bound. And nothing more.
If you need more versatility, use the `where` clauses. In practice, however, the
bounds are seldom needed.

[lifetime elision rules]: https://doc.rust-lang.org/1.58.1/reference/lifetime-elision.html#lifetime-elision-in-functions

0 comments on commit 47f4e55

Please sign in to comment.