8
의 내가 있다고 가정 해 봅시다 :엘릭서의 구조체 필드 유형을 확인하는 방법은 무엇입니까?
다음defmodule Operator do
defstruct operator: nil
@type t :: %Operator {
operator: oper
}
@type oper :: logic | arithmetic | nil
@type logic :: :or | :and
@type arithmetic :: :add | :mul
end
I 할 수 있습니다
o = %Operator{operator: :and}
이 o.operator
이 logic
, arithmetic
또는 nil
여부를 확인 할 수 있나요?
당신을 감사드립니다. 나는 그것을 할 수있는 매크로에 대해 생각할 것이다. – zie1ony