timex v3.1.16 Timex.Parse.Duration.Parser behaviour View Source

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.

Link to this section 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

Link to this section Functions

Link to this function parse(str) View Source
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.

Link to this function parse(str, parser) View Source
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.

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

Link to this function parse!(str, parser) View Source
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.

Link to this section Callbacks

Link to this callback parse(arg0) View Source
parse(String.t) :: {:ok, Timex.Duration.t} | {:error, term}