Kernel.struct-exclamation-mark

You're seeing just the function struct-exclamation-mark, go back to Kernel module for more information.
Link to this function

struct!(struct, fields \\ [])

View Source

Specs

struct!(module() | struct(), Enum.t()) :: struct()

Similar to struct/2 but checks for key validity.

The function struct!/2 emulates the compile time behaviour of structs. This means that:

  • when building a struct, as in struct!(SomeStruct, key: :value), it is equivalent to %SomeStruct{key: :value} and therefore this function will check if every given key-value belongs to the struct. If the struct is enforcing any key via @enforce_keys, those will be enforced as well;

  • when updating a struct, as in struct!(%SomeStruct{}, key: :value), it is equivalent to %SomeStruct{struct | key: :value} and therefore this function will check if every given key-value belongs to the struct. However, updating structs does not enforce keys, as keys are enforced only when building;