Skip to content

Commit

Permalink
Fixed readme
Browse files Browse the repository at this point in the history
  • Loading branch information
permutationlock committed Nov 24, 2023
1 parent e418657 commit 5176726
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ pub fn Impl(comptime T: type, comptime Ifc: fn (type) type) type { ... }
The function `Ifc` must always return a struct type. If `Unwrap(T)`
has a declaration matching the name of a field from
`Ifc(T)` that cannot coerce to the type of the field, then a
compile error will occur[^1].
compile error will occur.

### Unwrap

The internal `Unwrap` function removes all layers of `*`, `?`, or `!`
wrapping a type, e.g. `Unwrap(!?*u32)` is `u32`.

## Return value

The type `Impl(T, Ifc)` is a struct type with the same fields
as `Ifc(T)`, but with the default value of each field set equal to
the declaration of `Unwrap(T)` of the same name, if such a declaration
exists[^1].
exists.

## Example

Expand Down Expand Up @@ -109,6 +114,3 @@ More in-depth [examples][4] are provided.
[2]: https://en.wikipedia.org/wiki/Static_dispatch
[3]: https://github.com/permutationlock/zimpl/blob/main/why.md
[4]: https://github.com/permutationlock/zimpl/blob/main/examples

[^1]: The internal `Unwrap` function removes all layers of `*`, `?`, or `!`
wrapping a type, e.g. `Unwrap(!?*u32)` is `u32`.

0 comments on commit 5176726

Please sign in to comment.