puddle

Types

pub opaque type ManagerMessage(resource_type, result_type)
pub opaque type ResourceMessage(resource_type, result_type)

Functions

pub fn apply(
  manager: Subject(ManagerMessage(a, b)),
  fun: fn(a) -> b,
  timeout: Int,
  rest: fn(Result(b, Nil)) -> Result(c, Nil),
) -> Result(c, Nil)

checks-out a resource, applies the function and then checks-in the resource

pub fn shutdown(
  manager: Subject(ManagerMessage(a, b)),
  resource_shutdown_function: fn(a) -> Nil,
) -> Nil
pub fn start(
  size: Int,
  resource_creation_function: fn() -> Result(a, Nil),
) -> Result(Subject(ManagerMessage(a, b)), StartError)
Search Document