diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b373e29 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 8ed2237..1e6fb0c 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,13 @@ ## Reactive Extensions for D Programming Language [![Dub version](https://img.shields.io/dub/v/rx.svg)](https://code.dlang.org/packages/rx) -![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat) +[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://img.shields.io/badge/license-MIT-blue.svg?style=flat) [![Build Status](https://travis-ci.org/lempiji/rx.svg?branch=master)](https://travis-ci.org/lempiji/rx) ### Overview The is a library like the [Rx.NET](https://github.com/Reactive-Extensions/Rx.NET), for the asynchronous or event-based programs on OutputRange concept. -#### Basic concept interfaces - -```d -//module rx.disposable -interface Disposable -{ - void dispose(); -} - -//module rx.observer -interface Observer(E) : OutputRange!E -{ - //void put(E obj); //inherits from OutputRange!E - void completed(); - void failure(Exception e); -} - -//module rx.observable -interface Observable(E) -{ - alias ElementType = E; - Disposable subscribe(Observer!E observer); -} - -``` #### Example @@ -54,27 +29,65 @@ void main() foreach (i; 0 .. 10) { - subject.put(i); //fire some event + subject.put(i); } auto result = buf.data; - assert(equal(result, ["0", "2", "4", "6", "8"])); //receive some event + assert(equal(result, ["0", "2", "4", "6", "8"])); } ``` -### License +And [more examples](https://github.com/lempiji/rx/tree/master/examples) + +### Usage +Setting dependencies in dub.json +```json +{ + ... + "dependencies": { + "rx": "~>0.0.5" + } +} +``` +or dub.sdl +``` +dependency "rx" version="~>0.0.5" +``` -This library is under the MIT License. +### License +This library is under the MIT License. Some code is borrowed from [Rx.NET](https://github.com/Reactive-Extensions/Rx.NET). +### Concepts + +#### Basic interfaces + +```d +//module rx.disposable +interface Disposable +{ + void dispose(); +} + +//module rx.observer +interface Observer(E) : OutputRange!E +{ + //void put(E obj); //inherits from OutputRange!E + void completed(); + void failure(Exception e); +} + +//module rx.observable +interface Observable(E) +{ + alias ElementType = E; + Disposable subscribe(Observer!E observer); +} +``` + ### Future work - more algorithms - * zip - * takeUntil - * skipUntil -- more utilities - * generators - more test - more documents