Package

rx.lang

scala

Permalink

package scala

This package contains all classes that RxScala users need.

It basically mirrors the structure of package rx, but some changes were made to make it more Scala-idiomatic.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. scala
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. sealed trait Notification[+T] extends AnyRef

    Permalink

    Emitted by Observables returned by rx.lang.scala.Observable.materialize.

  2. trait Observable[+T] extends AnyRef

    Permalink

    The Observable interface that implements the Reactive Pattern.

  3. implicit final class ObservableExtensions[T] extends AnyVal

    Permalink

    Placeholder for extension methods into Observable[T] from other types

  4. trait Observer[-T] extends AnyRef

    Permalink

    Provides a mechanism for receiving push-based notifications.

    Provides a mechanism for receiving push-based notifications.

    After an Observer calls an rx.lang.scala.Observable's subscribe method, the Observable calls the Observer's onNext method to provide notifications. A well-behaved Observable will call an Observer's onCompleted or onError methods exactly once.

  5. trait Producer extends AnyRef

    Permalink
  6. trait Scheduler extends AnyRef

    Permalink

    Represents an object that schedules units of work.

  7. trait Subject[T] extends Observable[T] with Observer[T]

    Permalink

    A Subject is an Observable and an Observer at the same time.

  8. abstract class Subscriber[-T] extends Observer[T] with Subscription

    Permalink

    An extension of the Observer trait which adds subscription handling (unsubscribe, isUnsubscribed, and add methods) and backpressure handling (onStart and request methods).

    An extension of the Observer trait which adds subscription handling (unsubscribe, isUnsubscribed, and add methods) and backpressure handling (onStart and request methods).

    After a Subscriber calls an Observable's subscribe method, the Observable calls the Subscriber's onNext method to emit items. A well-behaved Observable will call a Subscriber's onCompleted method exactly once or the Subscriber's onError method exactly once.

    Similarly to the RxJava Subscriber, this class has two constructors:

    The first constructor takes as argument the child Subscriber from further down the pipeline and is usually only needed together with lift:

    myObservable.lift((subscriber: Subscriber[T]) => new Subscriber[T](subscriber) {
      override def onStart(): Unit = ...
      override def onNext(n: T): Unit = ...
      override def onError(e: Throwable): Unit = ...
      override def onCompleted(): Unit = ...
    })

    The second constructor takes no arguments and is typically used with the subscribe method:

    myObservable.subscribe(new Subscriber[T] {
      override def onStart(): Unit = ...
      override def onNext(n: T): Unit = ...
      override def onError(e: Throwable): Unit = ...
      override def onCompleted(): Unit = ...
    })

    Notice that these two constructors are not (as usually in Scala) in the companion object, because if they were, we couldn't create anonymous classes implementing onStart/onNext/onError/onCompleted as in the examples above. However, there are more constructors in the companion object, which allow you to construct Subscribers from given onNext/onError/onCompleted lambdas.

  9. trait Subscription extends AnyRef

    Permalink

    Subscriptions are returned from all Observable.subscribe methods to allow unsubscribing.

    Subscriptions are returned from all Observable.subscribe methods to allow unsubscribing.

    This interface is the equivalent of IDisposable in the .NET Rx implementation.

  10. trait Worker extends Subscription

    Permalink

Value Members

  1. object ImplicitFunctionConversions

    Permalink

    These function conversions convert between Scala functions and Rx Funcs and Actions.

    These function conversions convert between Scala functions and Rx Funcs and Actions. Most RxScala users won't need them, but they might be useful if one wants to use the rx.Observable directly instead of using rx.lang.scala.Observable or if one wants to use a Java library taking/returning Funcs and Actions. This object only contains conversions between functions. For conversions between types, use rx.lang.scala.JavaConversions.

  2. object JavaConversions

    Permalink

    These functions convert between RxScala types RxJava types.

    These functions convert between RxScala types RxJava types. Pure Scala projects won't need them, but they will be useful for polyglot projects. This object only contains conversions between types. For conversions between functions, use rx.lang.scala.ImplicitFunctionConversions.

  3. object Notification

    Permalink

    Provides pattern matching support and constructors for Notifications.

    Provides pattern matching support and constructors for Notifications.

    Example:

    import Notification._
    Observable.just(1, 2, 3).materialize.subscribe(n => n match {
      case OnNext(v)     => println("Got value " + v)
      case OnCompleted => println("Completed")
      case OnError(err)  => println("Error: " + err.getMessage)
    })
  4. object Observable

    Permalink

    Provides various ways to construct new Observables.

  5. object Observer extends ObserverFactoryMethods[Observer]

    Permalink
  6. object Producer

    Permalink
  7. object Subject

    Permalink

    Subject that, once an Observer has subscribed, emits all subsequently observed items to the subscriber.

    Subject that, once an Observer has subscribed, emits all subsequently observed items to the subscriber.

    Example:
    1. val subject = Subject[String]()
      // observer1 will receive all onNext and onCompleted events
      subject.subscribe(observer1)
      subject.onNext("one")
      subject.onNext("two")
      // observer2 will only receive "three" and onCompleted
      subject.subscribe(observer2)
      subject.onNext("three")
      subject.onCompleted()
  8. object Subscriber extends ObserverFactoryMethods[Subscriber]

    Permalink
  9. object Subscription

    Permalink
  10. object Worker

    Permalink
  11. package observables

    Permalink

    Contains special Observables.

    Contains special Observables.

    In Scala, this package only contains rx.lang.scala.observables.BlockingObservable. In the corresponding Java package rx.observables, there is also a GroupedObservable and a ConnectableObservable, but these are not needed in Scala, because we use a pair (key, observable) instead of GroupedObservable and a pair (startFunction, observable) instead of ConnectableObservable.

  12. package observers

    Permalink
  13. package schedulers

    Permalink
  14. package subjects

    Permalink

    Subjects are Observers and Observables at the same time.

  15. package subscriptions

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped