crystal-futures alternatives and similar shards
Based on the "Misc" category.
Alternatively, view crystal-futures alternatives based on common mentions on social networks and blogs.
-
guardian
Guardian watches over your files and run assigned tasks. -
sentry
Build/Runs your crystal application, watches files, and rebuilds/restarts app on file changes -
immutable
Thread-safe, persistent, immutable collections for the Crystal language -
crystagiri
An Html parser library for Crystal (like Nokogiri for Ruby) -
crz
Functional programming library for https://github.com/crystal-lang/crystal -
crystal-web-framework-stars
⭐️ Web frameworks for Crystal, most starred on Github -
cron_scheduler
Simple job scheduler with crontab patterns for Crystal Language. -
inflector.cr
Inflector shard for Crystal. A port of ActiveSupport::Inflector -
aasm.cr
:arrows_clockwise: Easy to use finite state machine for Crystal classes -
kreal
Kreal is a model sharing & RPC library built on and works with Kemal seamlessly. -
retriable.cr
Retriable.cr is a simple DSL to retry failed code blocks -
ulid
Universally Unique Lexicographically Sortable Identifier (ULID) in Crystal -
CrSerializer
Extensible annotation based serialization/deserialization library -
circuit_breaker
Implementation of the circuit breaker pattern in crystal -
burocracia.cr
No dependency Crystal shard to validate, generate and format Brazilian burocracias such as CPF, CNPJ and CEP -
wikicr
Wiki in crystal, using Markdown and Git, inspired by dokuwiki. Last features to build are pretty hard, if you have some time to help... :) -
m3u8
Generate and parse m3u8 playlists for HTTP Live Streaming (HLS) in Crystal. -
atomic_write.cr
Extends `File` to provide `atomic_write()`. -
message_verifier.cr
Rails compatible MessageVerifier for Crystal-lang apps -
defined
This shard provides facilities for checking whether a constant exists at compile time, and for a variety of different conditional compilation options. Code can be conditionally compiled based on the existence of a constant, version number constraints, or whether an environment variable is set truthy or not.
Static code analysis for 29 languages.
Do you think we are missing an alternative of crystal-futures or a related project?
README
crystal-futures 
Futures provide a nice way to reason about performing many operations in parallel– in an efficient and non-blocking way. The idea is simple, a Future is a sort of a placeholder object that you can create for a result that does not yet exist. Generally, the result of the Future is computed concurrently and can be later collected. Composing concurrent tasks in this way tends to result in faster, asynchronous, non-blocking parallel code.
** Source : http://docs.scala-lang.org/overviews/core/futures.html
Usage
require "futures"
include Futures
# Create a new future
a = Future.new do
someTimeConsumingOperation()
end
# Register a callback on successful operation
a.on_success do |val|
doSomethingWithResult val
end
a.on_failure do |err|
raise err
end
# Or handle both cases in one callback
a.on_complete do |result|
try = result.get
case try
when Success
puts try.get
when Failure
raise try.error
end
end
# Or block until future completes
val = a.get
# compose new Futures from existing ones
b = a.map do |val|
"String : " + val
end
b.get
Sequencing
Future implements crz Monad
interface
which means you can call bind on it to sequence multiple actions.
def get_first_value
Future.new do
# get a value from network
...
end
end
def get_second_value(first_value)
Future.new do
# get another value based on
# the first value
...
end
end
f = get_first_value.bind do |first_value|
get_second_value(first_value)
end
f.get # => second value
In case of multiple actions in sequence, nested binds can become
tedious and error prone. Use the crz mdo
macro to flatten
nested binds
mdo({
first <= get_first_value,
second <= get_second_value(first),
third <= get_third_value(first, second),
Future.of(third)
})
Make sure the last line of mdo is wrapped in a future using
Future.of or Future.new { value }
.
Note that <=
only works on Futures not on regular values
i.e. get_first_value
, get_second_value
, get_third_value
should return Futures.
You can make normal assignments from regular values inside mdo blocks too.
mdo({
x <= some_async_op,
a = x + 23,
...
})