typed_struct:一个Elixir库,用于在不编写样板代码的情况下使用类型定义结构

时间:2021-05-01 20:07:05
【文件属性】:
文件名称:typed_struct:一个Elixir库,用于在不编写样板代码的情况下使用类型定义结构
文件大小:28KB
文件格式:ZIP
更新时间:2021-05-01 20:07:05
Elixir TypedStruct TypedStruct是一个用于在不编写样板代码的情况下定义具有类型的结构的库。 基本原理 要在Elixir中定义一个结构,您可能要定义三件事: 结构本身,具有默认值, 强制密钥列表, 其关联的类型。 最终结果是这样的: defmodule Person do @moduledoc """ A struct representing a person. """ @enforce_keys [ :name ] defstruct name: nil , age: nil , happy?: true , phone: nil @typedoc "A person" @type t () :: % __MODULE__ { name: St
【文件预览】:
typed_struct-master
----mix.exs(3KB)
----.credo.exs(7KB)
----.envrc(3KB)
----.dialyzer_ignore(0B)
----lib()
--------typed_struct()
--------typed_struct.ex(14KB)
----.check.exs(821B)
----CONTRIBUTING.md(5KB)
----.travis.yml(504B)
----config()
--------config.exs(638B)
----LICENSE(1KB)
----.formatter.exs(291B)
----test()
--------typed_struct()
--------test_helper.exs(83B)
--------typed_struct_test.exs(8KB)
----README.md(9KB)
----mix.lock(6KB)
----shell.nix(602B)
----.editorconfig(290B)
----.gitignore(364B)
----CHANGELOG.md(2KB)
----.gitsetup(233B)

网友评论