timex v3.2.0 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
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(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!(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!(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
parse(String.t()) :: {:ok, Timex.Duration.t()} | {:error, term()}