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

sss.openstar.rpc.RpcOps.scala Maven / Gradle / Ivy

package sss.openstar.rpc

import sss.openstar.ui.rpc.Result

import scala.concurrent.{ExecutionContext, Future}

object RpcOps {

  implicit class ResultF[T](val result: Result[Future[T]]) extends AnyVal {
    def toFutureResult(implicit ec: ExecutionContext): Future[Result[T]] =
      result match {
        case Left(p) => Future.successful(Left(p))
        case Right(valueF) =>
          valueF.map(Right(_))
      }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy