当我从here尝试以下' Hello World' 示例时,应用程序永远不会停止。它是Iteratee,等待更多的输入吗?我试着像
这样的东西val enumerator = Enumerator(1, 234, 455, 987).andThen(Enumerator.enumInput(Input.EOF))
但它没有帮助。
在Iteratee完成Enumerator中的所有元素后,我该怎么办才能停止应用程序?
import scala.concurrent.Future
import play.api.libs.iteratee._
import scala.concurrent.ExecutionContext.Implicits.global
object Experiment
{
def main(args: Array[String])
{
val enumerator = Enumerator(1, 234, 455, 987)
enumerator(Iteratee.foreach( println _ ))
// same result with apply
//enumerator.apply(Iteratee.foreach( println _ ))
println("Main is done pretty soon but the application will never stop.")
}
}