View Source Tempus.Slots.Group protocol (Tempus v0.15.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

@type t() :: term()

All the types that implement this protocol.

Functions

Link to this function

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

View Source
@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.

Link to this function

flatten(slots, options \\ [])

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

Flattens the implementation, returning the list back.

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

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

Link to this function

inverse(slots, options \\ [])

View Source
@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.

Link to this function

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

View Source
@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.

Link to this function

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

View Source
@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.