All Projects β†’ mikecaines β†’ stream-throttle

mikecaines / stream-throttle

Licence: MIT license
Rust Stream combinator, to limit the rate at which items are produced

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to stream-throttle

NPAudioStream
Continuously stream a playlist of audio through a lightweight Objective-C library.
Stars: ✭ 23 (+21.05%)
Mutual labels:  stream
MyDemos
πŸ’Ύ Demo ι›†εˆ . 黑发不ηŸ₯ε‹€ε­¦ζ—©οΌŒη™½ι¦–ζ–Ήζ‚”θ―»δΉ¦θΏŸ.
Stars: ✭ 64 (+236.84%)
Mutual labels:  throttle
rtmp-social-multicast
Want to stream to Twitch, YouTube, Facebook, and/or Periscope at the same time? That's what this project allows you to do!
Stars: ✭ 42 (+121.05%)
Mutual labels:  stream
lead
Sink your streams.
Stars: ✭ 14 (-26.32%)
Mutual labels:  stream
mediapipe plus
The purpose of this project is to apply mediapipe to more AI chips.
Stars: ✭ 38 (+100%)
Mutual labels:  stream
panel
ReCast is a multi platform restreaming tool, you can stream with one servers to multiple services
Stars: ✭ 40 (+110.53%)
Mutual labels:  stream
elasticbulk
Add data in bulk to elasticsearch. It supports data streaming from PostgreSQL or Filesystem
Stars: ✭ 27 (+42.11%)
Mutual labels:  stream
PromisedFuture
A Swift based Future/Promises framework to help writing asynchronous code in an elegant way
Stars: ✭ 75 (+294.74%)
Mutual labels:  futures
jsCast
πŸ“» An Audio Streaming Application written in JavaScript
Stars: ✭ 23 (+21.05%)
Mutual labels:  stream
rec-core
Data pipelining service
Stars: ✭ 19 (+0%)
Mutual labels:  stream
stream-feed-flutter
Stream Feed official Flutter SDK. Build your own feed experience using Dart and Flutter.
Stars: ✭ 67 (+252.63%)
Mutual labels:  stream
SFMediaStream
HTML5 media streamer library for playing music, video, playlist, or even live streaming microphone & camera with node server
Stars: ✭ 97 (+410.53%)
Mutual labels:  stream
textics
πŸ“‰ JavaScript Text Statistics that counts lines, words, chars, and spaces.
Stars: ✭ 36 (+89.47%)
Mutual labels:  stream
aushape
A library and a tool for converting audit logs to XML and JSON
Stars: ✭ 37 (+94.74%)
Mutual labels:  stream
ionic-chat-tutorial-react
Build a Real-Time Chat App with Ionic, React, and Stream
Stars: ✭ 19 (+0%)
Mutual labels:  stream
plugin.video.sendtokodi
πŸ“Ί plays various stream sites on kodi using youtube-dl
Stars: ✭ 86 (+352.63%)
Mutual labels:  stream
FutureBuilderWithPagination
we're gonna look out how to work with Future Builder and show the result in GridView. We'll also see how to use Pagination with Future Builder.Future Builder is a widget that returns another widget based on futures execution result. It builds itself based on the latest AsyncSnapshots.
Stars: ✭ 45 (+136.84%)
Mutual labels:  futures
rush
rush.readthedocs.io/en/latest/
Stars: ✭ 42 (+121.05%)
Mutual labels:  throttle
node-twitch-get-stream
Gets the m3u8 direct stream URLs of a live stream on twitch.tv.
Stars: ✭ 45 (+136.84%)
Mutual labels:  stream
ElgatoLegacy
Use your Elgato Stream Deck on Windows 7, 8 and 8.1!
Stars: ✭ 25 (+31.58%)
Mutual labels:  stream

stream_throttle

Provides a Rust Stream combinator, to limit the rate at which items are produced.

Crates.io API Documentation

Key Features

  • Throttling is implemented via poll(), and not via any sort of buffering.
  • The throttling behaviour can be applied to both Stream's and Future's.
  • Multiple streams/futures can be throttled together as a group.
  • Feature flags to use various timer implementations.

Feature Flags

  • timer-tokio: Uses the tokio::time::delay_for() timer.
  • timer-futures-timer: Uses the futures_timer::Delay timer.

If you don't use the default timer (tokio), make sure to set default-features = false in your Cargo.toml, when you add stream_throttle as a dependency.

Example throttling of Stream

// allow no more than 5 items every 1 second
let rate = ThrottleRate::new(5, Duration::new(1, 0));
let pool = ThrottlePool::new(rate);

let work = stream::repeat(())
  .throttle(pool)
  .then(|_| futures::future::ready("do something else"))
  .for_each(|_| futures::future::ready(()));
  
work.await;

Example throttling of Future

let rate = ThrottleRate::new(5, Duration::new(1, 0));
let pool = ThrottlePool::new(rate);

let work = pool.queue()
  .then(|_| futures::future::ready("do something else"));
  
work.await;
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].