Padding specification with per-side values.
Maps to iced's Padding struct. Accepts a uniform number,
a {vertical, horizontal} tuple, an explicit four-side map,
or a %Padding{} struct with per-side overrides.
cast/1 always normalises to the full four-side map.
Struct form
The struct supports per-side padding via keyword construction:
Padding.from_opts(top: 4, bottom: 8)nil fields are stripped during encoding.
Summary
Functions
Normalises a padding value to the canonical four-side map with atom keys.
Constructs padding from a keyword list.
Types
Functions
Normalises a padding value to the canonical four-side map with atom keys.
Examples
iex> Plushie.Type.Padding.cast(8)
%{top: 8, right: 8, bottom: 8, left: 8}
iex> Plushie.Type.Padding.cast({4, 12})
%{top: 4, right: 12, bottom: 4, left: 12}
iex> Plushie.Type.Padding.cast(%{top: 1, right: 2, bottom: 3, left: 4})
%{top: 1, right: 2, bottom: 3, left: 4}
@spec from_opts(Keyword.t()) :: %Plushie.Type.Padding{ bottom: term(), left: term(), right: term(), top: term() }
Constructs padding from a keyword list.
Raises ArgumentError if any key is not a valid padding field.