timex v3.0.6 Timex.Parse.Duration.Parser behaviour

This module is responsible for parsing input strings into Duration structs. The actual parsing is delegated to specific parser modules, but this module provides a unified API for all of them.

Summary

Functions

Parses the given input using the ISO-8601 duration parser, and returns either an :ok, or :error tuple

Parses the given input using the provided parser module, and returns either an :ok, or :error tuple

Parses the given input using the ISO-8601 duration parser, and either returns a Duration, or raises an error

Parses the given input using the provided parser module, and either returns a Duration, or raises an error

Functions

parse(str)

Specs

parse(String.t) ::
  {:ok, Timex.Duration.t} |
  {:error, term}

Parses the given input using the ISO-8601 duration parser, and returns either an :ok, or :error tuple.

parse(str, parser)

Specs

parse(String.t, module) ::
  {:ok, Timex.Duration.t} |
  {:error, term}

Parses the given input using the provided parser module, and returns either an :ok, or :error tuple.

parse!(str)

Specs

parse!(String.t) :: Timex.Duration.t | no_return

Parses the given input using the ISO-8601 duration parser, and either returns a Duration, or raises an error.

parse!(str, parser)

Specs

parse!(String.t, module) ::
  Timex.Duration.t |
  no_return

Parses the given input using the provided parser module, and either returns a Duration, or raises an error.

Callbacks

parse(arg0)

Specs

parse(String.t) ::
  {:ok, Timex.Duration.t} |
  {:error, term}