View Source Tempus.Slots.Group protocol (Tempus v0.16.0)

The protocol to implement for the ordered collection of slots.

Summary

Types

t()

All the types that implement this protocol.

Functions

Adds a single t:Slot.t/0 instance to this t:Slots.t/1 (which is effectively Slots.t(t())) implementation. If merge/3 implementation returns {:error, __MODULE__}, this function would be used to add elements one by one through reduce/3.

Flattens the implementation, returning the list back.

The function returning the identity element, which can be merged into each and every implementation without changing it.

Efficient implementation of inversing slots. If this function returns {:error, __MODULE__}, the reduce/3 will be used instead.

Efficient implementation of merging slots. If this function returns {:error, __MODULE__}, the reduce/3 will be used instead.

Efficient implementation of splitting slots. If this function returns {:error, __MODULE__}, the reduce/3 will be used instead.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

add(slots, slot, options \\ [])

@spec add(t(), Tempus.Slot.origin(), keyword()) :: t()

Adds a single t:Slot.t/0 instance to this t:Slots.t/1 (which is effectively Slots.t(t())) implementation. If merge/3 implementation returns {:error, __MODULE__}, this function would be used to add elements one by one through reduce/3.

flatten(slots, options \\ [])

@spec flatten(
  t(),
  keyword()
) :: [Tempus.Slot.t()]

Flattens the implementation, returning the list back.

identity(slots)

@spec identity(t()) :: t()

The function returning the identity element, which can be merged into each and every implementation without changing it.

inverse(slots, options \\ [])

@spec inverse(
  t(),
  keyword()
) :: {:ok, t()} | {:error, module()}

Efficient implementation of inversing slots. If this function returns {:error, __MODULE__}, the reduce/3 will be used instead.

merge(slots, other, options \\ [])

@spec merge(t(), [Tempus.Slot.t()] | t(), keyword()) ::
  {:ok, t()} | {:error, module()}

Efficient implementation of merging slots. If this function returns {:error, __MODULE__}, the reduce/3 will be used instead.

split(slots, locator, options \\ [])

@spec split(t(), Tempus.Slots.locator(), keyword()) ::
  {:ok, t(), t()} | {:error, module()}

Efficient implementation of splitting slots. If this function returns {:error, __MODULE__}, the reduce/3 will be used instead.