slim-futures

Crates.ioslim-futures
lib.rsslim-futures
version0.1.0-alpha.0
sourcesrc
created_at2023-01-29 15:58:17.98457
updated_at2023-01-29 15:58:17.98457
descriptionAsynchronous tools that intends for smaller binary size.
homepage
repositoryhttps://github.com/EFanZh/slim-futures
max_upload_size
id771075
size372,795
EFanZh (EFanZh)

documentation

README

slim-futures

CI codecov Coverage Status

Provides Future and Stream combinators as a supplement for futures crate, but focus on small memory occupation and small binary size.

Advantages:

  • Have minimal memory occupation.
  • Some combinators have less internal states than their futures counterparts, which could be beneficial for binary size.
  • Supports more Try types, rather than only Result type.
  • Provides both asynchronous and synchronous version of combinators, where the asynchronous ones have a _async suffix.
  • Provides extra combinators that is not implemented by futures crate.

Disadvantages:

  • Combinators do not support FnOnce functions.
  • Unless it’s free, combinators do not implement FusedFuture and FusedStream.
  • Some combinators requires user to provide a method for taking ownership of a value by mutable reference. For example, AsyncIteratorExt::slim_fold_by* combinators requires user to specify a method for taking the value out of the future, either by Copying, Clone::clone, mem::take, or some other user provided function.
  • Currently, the project is in its early stage, APIs are not stabilized, and the implementations have not been fully verified, use with caution.

Here is the list of combinators provided by slim-futures, and their futures counterparts.

slim-futures futures Notes
AsyncIteratorExt::slim_all
AsyncIteratorExt::slim_all_async StreamExt::all
AsyncIteratorExt::slim_and_then
AsyncIteratorExt::slim_and_then_async TryStreamExt::and_then
AsyncIteratorExt::slim_any
AsyncIteratorExt::slim_any_async StreamExt::any
AsyncIteratorExt::slim_filter
AsyncIteratorExt::slim_filter_async StreamExt::filter
AsyncIteratorExt::slim_filter_map
AsyncIteratorExt::slim_filter_map_async StreamExt::filter_map
AsyncIteratorExt::slim_find
AsyncIteratorExt::slim_find_async
AsyncIteratorExt::slim_find_map
AsyncIteratorExt::slim_find_map_async
AsyncIteratorExt::slim_flat_map
AsyncIteratorExt::slim_flat_map_async StreamExt::flat_map
AsyncIteratorExt::slim_flatten StreamExt::flatten
AsyncIteratorExt::slim_fold_by*
AsyncIteratorExt::slim_fold_async_by* StreamExt::fold
AsyncIteratorExt::slim_for_each
AsyncIteratorExt::slim_for_each_async StreamExt::for_each
AsyncIteratorExt::slim_fuse StreamExt::fuse
AsyncIteratorExt::slim_inspect StreamExt::inspect
AsyncIteratorExt::slim_map StreamExt::map
AsyncIteratorExt::slim_map_async StreamExt::then
AsyncIteratorExt::slim_map_err TryStreamExt::map_err
AsyncIteratorExt::slim_map_err_async
AsyncIteratorExt::slim_map_ok TryStreamExt::map_ok
AsyncIteratorExt::slim_map_ok_async
AsyncIteratorExt::slim_map_while
AsyncIteratorExt::slim_map_while_async
AsyncIteratorExt::slim_or_else
AsyncIteratorExt::slim_or_else_async TryStreamExt::or_else
AsyncIteratorExt::slim_reduce
AsyncIteratorExt::slim_reduce_async
AsyncIteratorExt::slim_scan
AsyncIteratorExt::slim_scan_async StreamExt::scan
AsyncIteratorExt::slim_skip_while
AsyncIteratorExt::slim_skip_while_async StreamExt::skip_while
AsyncIteratorExt::slim_take_while
AsyncIteratorExt::slim_take_while_async StreamExt::take_while
AsyncIteratorExt::slim_try_fold_by*
AsyncIteratorExt::slim_try_fold_async_by* TryStreamExt::try_fold Follows Iterator::try_fold.
AsyncIteratorExt::slim_try_for_each
AsyncIteratorExt::slim_try_for_each_async TryStreamExt::try_for_each Follows Iterator::try_for_each.
AsyncIteratorExt::slim_zip StreamExt::zip
FutureExt::slim_and_then
FutureExt::slim_and_then_async TryFutureExt::and_then
FutureExt::slim_err_into TryFutureExt::err_into
FutureExt::slim_flatten FutureExt::flatten
FutureExt::slim_flatten_async_iter FutureExt::flatten_stream
FutureExt::slim_inspect FutureExt::inspect
FutureExt::slim_inspect_err TryFutureExt::inspect_err
FutureExt::slim_inspect_ok TryFutureExt::inspect_ok
FutureExt::slim_into_option_future
FutureExt::slim_into_result_future
FutureExt::slim_into_try_future
FutureExt::slim_map FutureExt::map
FutureExt::slim_map_async FutureExt::then
FutureExt::slim_map_err TryFutureExt::map_err
FutureExt::slim_map_err_async
FutureExt::slim_map_into FutureExt::map_into
FutureExt::slim_map_ok TryFutureExt::map_ok
FutureExt::slim_map_ok_async
FutureExt::slim_map_ok_or_else TryFutureExt::map_ok_or_else
FutureExt::slim_map_ok_or_else_async
FutureExt::slim_never_error FutureExt::never_error
FutureExt::slim_ok_into TryFutureExt::ok_into
FutureExt::slim_or_else
FutureExt::slim_or_else_async TryFutureExt::or_else
FutureExt::slim_raw_map_ok_or_else_async
FutureExt::slim_try_flatten TryFutureExt::try_flatten
FutureExt::slim_try_flatten_err
FutureExt::slim_unit_error FutureExt::unit_error
FutureExt::slim_unwrap_or_else TryFutureExt::unwrap_or_else
FutureExt::slim_unwrap_or_else_async
err_by* err
lazy lazy
ok_by* ok
raw_select
ready_by* ready
select_either
try_select_either
Commit count: 263

cargo fmt