Slither.Item (Slither v0.1.0)

Copy Markdown View Source

Work envelope carrying a payload through Slither pipelines.

Every item has a stable ID for ordering and error attribution, stage-local metadata for tracing, and a route tag for dispatch without coupling payload types.

Summary

Functions

Merge metadata into an item's meta map.

Update the payload of an item, preserving ID and metadata.

Wrap a raw payload into an Item with an auto-generated ID.

Wrap a list of payloads into Items with sequential IDs.

Types

id()

@type id() :: pos_integer() | binary()

t()

@type t() :: %Slither.Item{id: id(), meta: map(), payload: term(), route: atom()}

Functions

put_meta(item, new_meta)

@spec put_meta(t(), map()) :: t()

Merge metadata into an item's meta map.

update_payload(item, new_payload)

@spec update_payload(t(), term()) :: t()

Update the payload of an item, preserving ID and metadata.

wrap(payload)

@spec wrap(term()) :: t()

Wrap a raw payload into an Item with an auto-generated ID.

wrap_many(payloads)

@spec wrap_many(Enumerable.t()) :: [t()]

Wrap a list of payloads into Items with sequential IDs.