The Reactive Extensions for the Rust Programming Language

Overview

This is an implementation of reactive streams, which, at the high level, is patterned off of the interfaces and protocols defined in http://reactive-streams.org.

It also draws a lot of inspiration from clojures Transducers, in that it attempts to decouple the functions doing the work from their plumbing. It does this with Strategies. These effect how a publisher/processor will consume and output data.

The high level API built on top of the interfaces (the customer facing portions) draw inspiration more from Elm than the java based Rx libraries.

The core types are as follows:

Producer<Strategy, Output> 

Producer is where most of the action happens. It generates data and supplies a datum at a time to its subscribers via the Subscriber::on_next method. If it has multiple subscribers, how it supplies each subscriber with data is up to the Strategy. It also limits its output using a pushback mechanism by being supplied a request amount by the subscriber (via its subscription). The hope is that a producer can be as simple as a proc, relying on the strategy and the subscription objects to do most of its heavy lifting, while the proc does only data transformation/generation.

OutputStrategy<Output>

There are many ways a producer might distribute data. When request limiting is present, there are a few options a strategy might take:

  1. Keep all subscribers in-sync by broadcasting to all only when they all have remaining requests.
  2. Eagerly send to any subscribers with available requests, discarding the messages to those without.
  3. Round-Robin across subscribers with available requests.
  4. Keep a queue for each subscriber which is currently without requests, in an attempt to keep all subscribers in sync.
InputStrategy<...>

An input Strategy is what copes with various types of input, Iterators, data structures, multiple subscriptions, etc. It can choose to execute one when it receives the other, or selects, or anything, really.

Subscriber<Input>

The subscriber subscribes to a Producer. Its only responsibility is to supply to the producer a reqeust number (via the subscription object) which acts as a backpressure mechanism.

Processor<Strategy, Input, Output> : Producer<Strategy, Output> + Subscriber<Input>

A processor is simply a Producer + a Subscriber. It is a link in the execution chain. Among its other responsibilities, it must pass down request backpressure values from its subscribers. It would also propagate errors downstream, and propagate unsubscribes upstream.

LICENSE

The MIT License (MIT)

Copyright (c) 2015 ReactiveX

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.

You might also like...
lingua-rs Python binding. An accurate natural language detection library, suitable for long and short text alike.

lingua-py lingua-rs Python binding. An accurate natural language detection library, suitable for long and short text alike. Installation pip install l

Ultra-fast, spookily accurate text summarizer that works on any language
Ultra-fast, spookily accurate text summarizer that works on any language

pithy 0.1.0 - an absurdly fast, strangely accurate, summariser Quick example: pithy -f your_file_here.txt --sentences 4 --help: Print this help messa

Fast suffix arrays for Rust (with Unicode support).
Fast suffix arrays for Rust (with Unicode support).

suffix Fast linear time & space suffix arrays for Rust. Supports Unicode! Dual-licensed under MIT or the UNLICENSE. Documentation https://docs.rs/suff

Elastic tabstops for Rust.

tabwriter is a crate that implements elastic tabstops. It provides both a library for wrapping Rust Writers and a small program that exposes the same

An efficient and powerful Rust library for word wrapping text.

Textwrap Textwrap is a library for wrapping and indenting text. It is most often used by command-line programs to format dynamic output nicely so it l

⏮ ⏯ ⏭ A Rust library to easily read forwards, backwards or randomly through the lines of huge files.

EasyReader The main goal of this library is to allow long navigations through the lines of large files, freely moving forwards and backwards or gettin

An implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs.

regex A Rust library for parsing, compiling, and executing regular expressions. Its syntax is similar to Perl-style regular expressions, but lacks a f

Multilingual implementation of RAKE algorithm for Rust

RAKE.rs The library provides a multilingual implementation of Rapid Automatic Keyword Extraction (RAKE) algorithm for Rust. How to Use Append rake to

A Rust library for generically joining iterables with a separator

joinery A Rust library for generically joining iterables with a separator. Provides the tragically missing string join functionality to rust. extern c

Comments
  • Compilable with latest Rust?

    Compilable with latest Rust?

    Hey there, is there any chance that this library will be compilable with the current rust compiler any time soon? :) Seems to be more than just fixing the errors occurring due to the new rust syntax :/ (which is a little bit out of scope for me as a rust beginner). Thank you in advance!

    opened by mputz86 0
  • What would RxRust look like?

    What would RxRust look like?

    How could we shape an Rx like solution in the Rust Programming Language?

    Would it be as simple as?

    struct Observable {
    
    }
    
    impl Observable {
      fn subscribe<T>(&self, observer: Observer) { 
        ...
      }
    }
    

    And then how would it look like if we used it? Could we support chaining?

    opened by mattpodwysocki 12
Owner
ReactiveX
Reactive Extensions for Async Programming
ReactiveX
Rust programming, in Japanese

sabi In Japanese version https://github.com/bnjbvr/rouille. Shamelessly copied and updated from it. 日本語で Rust プログラムを書くことができます! 例 main.rs sabi::sabi! {

Yuki Toyoda 54 Dec 30, 2022
Rust-nlp is a library to use Natural Language Processing algorithm with RUST

nlp Rust-nlp Implemented algorithm Distance Levenshtein (Explanation) Jaro / Jaro-Winkler (Explanation) Phonetics Soundex (Explanation) Metaphone (Exp

Simon Paitrault 34 Dec 20, 2022
Natural language detection library for Rust. Try demo online: https://www.greyblake.com/whatlang/

Whatlang Natural language detection for Rust with focus on simplicity and performance. Content Features Get started Documentation Supported languages

Sergey Potapov 805 Dec 28, 2022
👄 The most accurate natural language detection library in the Rust ecosystem, suitable for long and short text alike

Table of Contents What does this library do? Why does this library exist? Which languages are supported? How good is it? Why is it better than other l

Peter M. Stahl 569 Jan 3, 2023
A fast, low-resource Natural Language Processing and Text Correction library written in Rust.

nlprule A fast, low-resource Natural Language Processing and Error Correction library written in Rust. nlprule implements a rule- and lookup-based app

Benjamin Minixhofer 496 Jan 8, 2023
Natural Language Processing for Rust

rs-natural Natural language processing library written in Rust. Still very much a work in progress. Basically an experiment, but hey maybe something c

Chris Tramel 211 Dec 28, 2022
Rust-tokenizer offers high-performance tokenizers for modern language models, including WordPiece, Byte-Pair Encoding (BPE) and Unigram (SentencePiece) models

rust-tokenizers Rust-tokenizer offers high-performance tokenizers for modern language models, including WordPiece, Byte-Pair Encoding (BPE) and Unigra

null 165 Jan 1, 2023
A HDPSG-inspired symbolic natural language parser written in Rust

Treebender A symbolic natural language parsing library for Rust, inspired by HDPSG. What is this? This is a library for parsing natural or constructed

Theia Vogel 32 Dec 26, 2022
Simple, extendable and embeddable scripting language.

duckscript duckscript SDK CLI Simple, extendable and embeddable scripting language. Overview Language Goals Installation Homebrew Binary Release Ducks

Sagie Gur-Ari 356 Dec 24, 2022
Query textual streams with PromQL-like language

pq - query textual streams with PromQL Glossary Time Series - a stream of timestamped values, aka samples sharing the same metric name and, optionally

Ivan Velichko 310 Dec 23, 2022