View Source TypedStructor.Definer.Defstruct (TypedStructor v0.5.0)

A definer to define a struct and a type for a given definition.

Additional options for typed_structor

  • :define_struct - if false, the type will be defined, but the struct will not be defined. Defaults to true.

Usage

defmodule MyStruct do
  use TypedStructor

  typed_structor definer: :defstruct, define_struct: false do
    field :name, String.t()
    field :age, integer()
  end
end

Summary

Functions

Defines a struct and a type for a given definition.

Functions

Link to this macro

define(definition)

View Source (macro)

Defines a struct and a type for a given definition.