Emerge.Engine.Tree (Emerge v0.2.1)

Copy Markdown View Source

Utilities for working with Emerge.Engine.Element trees.

Summary

Functions

Assign ids to elements missing an id.

Assign ids using a previous tree (compatibility wrapper).

Compute a hash of attributes excluding volatile fields.

Merge nearby mounts back into an attrs map.

Return nearby mounted children in canonical order.

Return the fixed nearby slot tag order used across encoding.

Return the list of runtime-only attributes.

Split nearby mount attrs from ordinary attrs.

Drop nearby mounts from an attrs map.

Drop runtime-only attributes from an attrs map.

Types

id_state()

@type id_state() :: %{explicit_seen: term()}

Functions

assign_ids(element, state \\ default_id_state())

Assign ids to elements missing an id.

assign_ids_with_prev(element, prev_element, state \\ default_id_state())

@spec assign_ids_with_prev(
  Emerge.Engine.Element.t(),
  Emerge.Engine.Element.t() | nil,
  id_state()
) ::
  {Emerge.Engine.Element.t(), id_state()}

Assign ids using a previous tree (compatibility wrapper).

attrs_hash(attrs)

@spec attrs_hash(map()) :: non_neg_integer()

Compute a hash of attributes excluding volatile fields.

default_id_state()

merge_nearby_attrs(attrs, nearby)

Merge nearby mounts back into an attrs map.

nearby_children(element)

Return nearby mounted children in canonical order.

nearby_slots()

Return the fixed nearby slot tag order used across encoding.

runtime_attrs()

Return the list of runtime-only attributes.

split_nearby_attrs(attrs)

Split nearby mount attrs from ordinary attrs.

strip_nearby_attrs(attrs)

Drop nearby mounts from an attrs map.

strip_runtime_attrs(attrs)

Drop runtime-only attributes from an attrs map.