Scala Reactive Extensions Observable 应用方法
Scala Reactive Extensions Observable apply Method
来自 API scala 中 Rx Observable 的文档:
http://reactivex.io/rxscala/scaladoc/#rx.lang.scala.Observable
有两种应用方法,一种接受订阅者,另一种接受观察者。除了采用不同类型来订阅 Observable 之外,这两个 apply 方法之间有什么区别?
abstract class Subscriber[-T] extends Observer[T] with Subscription
An extension of the Observer trait which adds subscription handling
(unsubscribe, isUnsubscribed, and add methods) and backpressure
handling (onStart and request methods).
所以我们可以假设 Observer
's apply
is more general binding which could take some proxied or self-defined observers and implements the observer pattern, while Subscriber
's apply
是更有效的内部绑定。
详情见this question。
来自 API scala 中 Rx Observable 的文档:
http://reactivex.io/rxscala/scaladoc/#rx.lang.scala.Observable
有两种应用方法,一种接受订阅者,另一种接受观察者。除了采用不同类型来订阅 Observable 之外,这两个 apply 方法之间有什么区别?
abstract class Subscriber[-T] extends Observer[T] with Subscription
An extension of the Observer trait which adds subscription handling (unsubscribe, isUnsubscribed, and add methods) and backpressure handling (onStart and request methods).
所以我们可以假设 Observer
's apply
is more general binding which could take some proxied or self-defined observers and implements the observer pattern, while Subscriber
's apply
是更有效的内部绑定。
详情见this question。