func (o Observable) AsObservableFoo() ObservableFoo {
	observable := func(observe FooObserver, subscribeOn Scheduler, subscriber Subscriber) {
		observer := func(next interface{}, err error, done bool) {
			if !done {
				if nextFoo, ok := next.(foo); ok {
					observe(nextFoo, err, done)
				} else {
					var zero foo
					observe(zero, TypecastFailed, true)
				}
			} else {
				var zero foo
				observe(zero, err, true)
			}
		}
		o(observer, subscribeOn, subscriber)
	}
	return observable
}
jig:template Observable AsObservable<Foo>
jig:needs Observable<Foo>, TypecastFailed
jig:required-vars Foo
AsObservableFoo turns an Observable of interface{} into an ObservableFoo.
If during observing a typecast fails, the error ErrTypecastToFoo will be
emitted.
package rx
func (o Observer) AsFooObserver() FooObserver {
	observer := func(next foo, err error, done bool) {
		o(next, err, done)
	}
	return observer
}
func (o ObservableFoo) AsObservableBar() ObservableBar {
	observable := func(observe BarObserver, subscribeOn Scheduler, subscriber Subscriber) {
		observer := func(next foo, err error, done bool) {
			observe(bar(next), err, done)
		}
		o(observer, subscribeOn, subscriber)
	}
	return observable
}
const TypecastFailed = RxError("typecast failed")