Skip to content

Instantly share code, notes, and snippets.

Created May 28, 2018 06:09
What would you like to do?
class MemorySink[A] extends Sink[A]{
  private var buffer: Vector[A] = Vector.empty

  def replay: Vector[A] = buffer

  def last: Option[A] = buffer.lastOption

  override def apply(a: A): Async[Unit] = Async {
    buffer :+= a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment