All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ciris.decoders.DurationConfigDecoders.scala Maven / Gradle / Ivy

There is a newer version: 0.12.1
Show newest version
package ciris.decoders

import ciris.ConfigDecoder

import scala.concurrent.duration.{Duration, FiniteDuration}

trait DurationConfigDecoders {
  implicit val durationConfigDecoder: ConfigDecoder[String, Duration] =
    ConfigDecoder.catchNonFatal("Duration")(Duration.apply)

  implicit val finiteDurationConfigDecoder: ConfigDecoder[String, FiniteDuration] =
    durationConfigDecoder.mapOption("FiniteDuration") { duration =>
      Some(duration).collect { case finite: FiniteDuration => finite }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy