-
Notifications
You must be signed in to change notification settings - Fork 68
Description
This codebase likes to shift back and forth between various nomenclature for various actors. It's not clear whether to call a consumer of values a Subscriber or an Observer. The trait's name is Observer:
pub trait Observer {
type Item;
type Err;
fn next(&mut self, value: Self::Item);
fn error(&mut self, err: Self::Err);
fn complete(&mut self);
}This agrees with ReactiveX documentation elsewhere (Ex: It's most popular implementation RxJS), though this isn't as consistent as we might hope. Throughout the code, tests/ docs instances of observers are often called subscribers. rxRust should endeavor to choose one name and stick with it everywhere.
Is the following subscriber is actually an observer? It seems to implement the Observer trait.
let o = observable::create(|subscriber| {
subscriber.complete();
})The docs also often refer to Subscriptions or SubscriptionLike as Subscriber meaning that sometimes Subscriber means Observer and sometimes it means SubscriptionLike. For example:
/// Returns a new Observable that multicast (shares) the original
/// Observable. As long as there is at least one Subscriber this
/// Observable will be subscribed and emitting data.
Subscribing with an Observer, returns a SubscriptionLike (via SubscriptionWrapper) and it's ostensibly this Subscription that determines how long an Observable lives.
I'm not sure I get all the nuance at work here, but I think some tightening of the common vernacular might help!