DSL element for future transformations in send pipeline

This commit is contained in:
Roland 2013-02-03 22:32:23 +01:00
parent a9cb1f9c19
commit 859589b9d4
3 changed files with 11 additions and 1 deletions

View file

@ -104,7 +104,7 @@ trait Channels[P <: ChannelList, C <: ChannelList] { this: Actor ⇒
else
F2(recv.asInstanceOf[(Any, ChannelRef[ChannelList]) Unit])
def apply(recv: R): Unit = {
val tt = implicitly[ru.TypeTag[Ch]]
val tt = ru.typeTag[Ch]
behavior ++= (for (t inputChannels(ru)(tt.tpe)) yield tt.mirror.runtimeClass(t.widen) -> ff(recv))
}
}

View file

@ -56,6 +56,7 @@ class ActorRefOps(val ref: ActorRef) extends AnyVal {
class FutureOps[T](val future: Future[T]) extends AnyVal {
def -!->[C <: ChannelList](channel: ChannelRef[C]): Future[T] = macro macros.Tell.futureOpsImpl[C, T]
def -?->[C <: ChannelList](channel: ChannelRef[C]): Future[_] = macro macros.Ask.futureImpl[ChannelList, Any, C, T]
def -*->[U](f: Future[T] Future[U]): Future[U] = f(future)
def lub[LUB](implicit ev: T <:< WrappedMessage[_, LUB]): Future[LUB] = {
implicit val ec = ExecutionContexts.sameThreadExecutionContext
future map (ev(_).value)