Current section
Files
Jump to
Current section
Files
src/plushie@patch.erl
-module(plushie@patch).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/plushie/patch.gleam").
-export_type([patch_op/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" Patch operations for tree diffs.\n"
"\n"
" Produced by `tree.diff` and consumed by `protocol/encode` to send\n"
" incremental updates to the Rust binary. Each operation targets a\n"
" node by its path -- a list of integer child indices from the root.\n"
" For example, `[0, 2]` means \"root's first child, then that node's\n"
" third child\".\n"
).
-type patch_op() :: {replace_node, list(integer()), plushie@node:node_()} |
{update_props,
list(integer()),
gleam@dict:dict(binary(), plushie@node:prop_value())} |
{insert_child, list(integer()), integer(), plushie@node:node_()} |
{remove_child, list(integer()), integer()}.