just运算

just图标说明如下:

just运算_第1张图片
Just
/**
Returns an observable sequence that contains a single element.
seealso: http://reactivex.io/documentation/operators/just.html
*/
public static func just(element: E)->Observable {
    return Just(element: element)
}

class Just: Producer {
    private let _element: Element

    init(element: Element) {
        _element = element
    }

    override func subscribe(observer: O)->Disposable {
        observer.on(.Next(_element))
        observer.on(.Completed)
        return NopDisposable.instance
    }
}

你可能感兴趣的:(just运算)