Skip to content

Commit

Permalink
fixup! refactor: extract definer
Browse files Browse the repository at this point in the history
  • Loading branch information
fahchen committed Sep 25, 2024
1 parent 9beb391 commit c6dd87d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/typed_structor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ defmodule TypedStructor do
* `:define_struct` - if `false`, the type will be defined, but the struct will not be defined. Defaults to `true`.
### custom definer
defmodule MyStruct do
# you must require the definer module to use its define/1 macro
require MyDefiner
use TypedStructor
typed_structor definer: &MyDefiner.define/1 do
field :name, String.t()
field :age, integer()
end
end
## Examples
defmodule MyStruct do
Expand Down

0 comments on commit c6dd87d

Please sign in to comment.