ciris.decoders.DurationConfigDecoders.scala Maven / Gradle / Ivy
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