Skip to content

Commit

Permalink
Merge pull request #424 from AVSystem/duration-ops
Browse files Browse the repository at this point in the history
Add ScalaDurationExtensions
  • Loading branch information
Roman Janusz authored Aug 30, 2022
2 parents 60c230b + 84be4a2 commit d770cb3
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.avsystem.commons
package misc

import scala.concurrent.duration.{DoubleMult, DurationDouble, DurationInt, DurationLong, IntMult, LongMult}

/**
* Gathers all extensions from [[scala.concurrent.duration]] into one trait that can be mixed in with package object.
*/
trait ScalaDurationExtensions {
implicit def durationIntOps(n: Int): DurationInt = new DurationInt(n)
implicit def durationLongOps(n: Long): DurationLong = new DurationLong(n)
implicit def durationDoubleOps(d: Double): DurationDouble = new DurationDouble(d)
implicit def durationIntMulOps(i: Int): IntMult = new IntMult(i)
implicit def durationLongMulOps(i: Long): LongMult = new LongMult(i)
implicit def durationDoubleMulOps(d: Double): DoubleMult = new DoubleMult(d)
}
object ScalaDurationExtensions extends ScalaDurationExtensions

0 comments on commit d770cb3

Please sign in to comment.