# Fuel

Provides some useful modules that help with building consistent applications.

# Ctx

Provides a context object similar to golangs `context.Context` that provides a way to thread data through a call-stack or even across process boundaries.

This is very useful for dependency injection especially when testing.

For example


setup do
  ctx =
    |> Fuel.Ctx.with_impl(MyBehaviour, MyBehaviourMock)
  {:ok, %{ctx: ctx}}

test "test my thing", ctx do
  options = Fuel.Ctx.ctx_into(ctx.ctx, [])

  |> expect(:some_call, fn _, _ -> :ok end)

  assert :ok == MyThing.call_a_function("yay", options)

In your code:

  def call_a_function(arg1, options) do
    with ctx <- Fuel.Ctx.ctx_from(options),
         my_behaviour <- Fuel.Ctx.fetch_impl(ctx, MyBehaviour) do
      my_behaviour.some_call(arg1, options)

Contexts are useful for more than just DI.

## Installation

If [available in Hex](, the package can be installed
by adding `fuel` to your list of dependencies in `mix.exs`:

def deps do
    {:fuel, "~> 0.1.0"}

Documentation can be generated with [ExDoc](
and published on [HexDocs]( Once published, the docs can
be found at [](