From 9fe8331210d75af88addf0785bb702c3d5a2a353 Mon Sep 17 00:00:00 2001 From: asonix Date: Sat, 9 Sep 2023 16:31:37 -0400 Subject: [PATCH] Rename to streem --- Cargo.toml | 4 ++-- README.md | 8 ++++---- examples/filter.rs | 6 +++--- examples/from_iter.rs | 4 ++-- examples/map.rs | 6 +++--- examples/try_stream.rs | 6 +++--- flake.nix | 2 +- src/from_fn.rs | 4 ++-- src/lib.rs | 2 ++ src/streamer.rs | 12 ++++++------ 10 files changed, 28 insertions(+), 26 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 919e02e..8676703 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "streaming" +name = "streem" description = "Simple utilities for creating and consuming streams" version = "0.1.0" license = "GPL-3.0" authors = ["asonix "] repository = "https://git.asonix.dog/asonix/streaming" -documentation = "https://docs.rs/streaming" +documentation = "https://docs.rs/streem" readme = "README.md" keywords = ["async", "streams"] edition = "2021" diff --git a/README.md b/README.md index 10af395..d130f7f 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ -# Streaming +# Streem A simple library for creating and consuming async streams ## Usage ```bash -$ cargo add streaming +$ cargo add streem ``` ```rust -use streaming::IntoStreamer; +use streem::IntoStreamer; fn from_iter(iter: impl IntoIterator) -> impl futures_core::Stream where I: 'static, { - streaming::from_fn(|yielder| async move { + streem::from_fn(|yielder| async move { for i in iter { yielder.yield_(i).await; } diff --git a/examples/filter.rs b/examples/filter.rs index f894f2e..85e1f77 100644 --- a/examples/filter.rs +++ b/examples/filter.rs @@ -1,14 +1,14 @@ -use streaming::IntoStreamer; +use streem::IntoStreamer; fn main() { futures_executor::block_on(async { - let input_stream = std::pin::pin!(streaming::from_fn(|yielder| async move { + let input_stream = std::pin::pin!(streem::from_fn(|yielder| async move { for i in 0..10 { yielder.yield_(i).await; } })); - let filter_stream = std::pin::pin!(streaming::from_fn(|yielder| async move { + let filter_stream = std::pin::pin!(streem::from_fn(|yielder| async move { let mut streamer = input_stream.into_streamer(); while let Some(item) = streamer.next().await { diff --git a/examples/from_iter.rs b/examples/from_iter.rs index 35ece21..045a864 100644 --- a/examples/from_iter.rs +++ b/examples/from_iter.rs @@ -1,10 +1,10 @@ -use streaming::IntoStreamer; +use streem::IntoStreamer; fn from_iter(iter: impl IntoIterator) -> impl futures_core::Stream where I: 'static, { - streaming::from_fn(|yielder| async move { + streem::from_fn(|yielder| async move { for i in iter { yielder.yield_(i).await; } diff --git a/examples/map.rs b/examples/map.rs index faedb3f..e21ee82 100644 --- a/examples/map.rs +++ b/examples/map.rs @@ -1,14 +1,14 @@ -use streaming::IntoStreamer; +use streem::IntoStreamer; fn main() { futures_executor::block_on(async { - let input_stream = std::pin::pin!(streaming::from_fn(|yielder| async move { + let input_stream = std::pin::pin!(streem::from_fn(|yielder| async move { for i in 0..10 { yielder.yield_(i).await; } })); - let map_stream = std::pin::pin!(streaming::from_fn(|yielder| async move { + let map_stream = std::pin::pin!(streem::from_fn(|yielder| async move { let mut streamer = input_stream.into_streamer(); while let Some(item) = streamer.next().await { diff --git a/examples/try_stream.rs b/examples/try_stream.rs index e297803..5794576 100644 --- a/examples/try_stream.rs +++ b/examples/try_stream.rs @@ -1,8 +1,8 @@ -use streaming::IntoStreamer; +use streem::IntoStreamer; fn main() -> Result<(), &'static str> { futures_executor::block_on(async { - let input_stream = std::pin::pin!(streaming::from_fn(|yielder| async move { + let input_stream = std::pin::pin!(streem::from_fn(|yielder| async move { for item in [Ok(1), Ok(2), Err("failure")] { yielder.yield_(item).await; } @@ -10,7 +10,7 @@ fn main() -> Result<(), &'static str> { let mut input_streamer = input_stream.into_streamer(); - let output_stream = std::pin::pin!(streaming::try_from_fn(|yielder| async move { + let output_stream = std::pin::pin!(streem::try_from_fn(|yielder| async move { while let Some(item) = input_streamer.try_next().await? { yielder.yield_ok(item).await; } diff --git a/flake.nix b/flake.nix index 911df04..026b1d6 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "streaming"; + description = "streem"; inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; diff --git a/src/from_fn.rs b/src/from_fn.rs index 9b1ebfb..a832217 100644 --- a/src/from_fn.rs +++ b/src/from_fn.rs @@ -71,7 +71,7 @@ impl Yielder> { /// /// Example: /// ```rust -/// let input_stream = streaming::from_fn(|yielder| async move { +/// let input_stream = streem::from_fn(|yielder| async move { /// for i in 0..10 { /// yielder.yield_(i).await; /// } @@ -97,7 +97,7 @@ where /// # Ok(i) /// } /// -/// let input_stream = streaming::try_from_fn(|yielder| async move { +/// let input_stream = streem::try_from_fn(|yielder| async move { /// for i in 0..10 { /// let value = fallible_fn(i)?; /// diff --git a/src/lib.rs b/src/lib.rs index 3fea086..0598d31 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +#![doc = include_str!("../README.md")] + pub mod from_fn; pub mod streamer; diff --git a/src/streamer.rs b/src/streamer.rs index 4eef600..a864e86 100644 --- a/src/streamer.rs +++ b/src/streamer.rs @@ -6,8 +6,8 @@ pub trait IntoStreamer: futures_core::Stream { /// /// Example /// ```rust - /// use streaming::IntoStreamer; - /// let stream = streaming::from_fn(|yielder| async move { yielder.yield_(1).await; }); + /// use streem::IntoStreamer; + /// let stream = streem::from_fn(|yielder| async move { yielder.yield_(1).await; }); /// let pinned = std::pin::pin!(stream); /// let streamer = pinned.into_streamer(); /// ``` @@ -31,12 +31,12 @@ impl Streamer { /// /// Example: /// ```rust - /// let input_stream = std::pin::pin!(streaming::from_fn(|yielder| async move { + /// let input_stream = std::pin::pin!(streem::from_fn(|yielder| async move { /// # for i in 0..10 { /// # yielder.yield_(i).await; /// # } /// })); - /// use streaming::IntoStreamer; + /// use streem::IntoStreamer; /// /// let mut streamer = input_stream.into_streamer(); /// @@ -61,7 +61,7 @@ impl Streamer { /// # Ok(i) /// # } /// # - /// let input_stream = std::pin::pin!(streaming::try_from_fn(|yielder| async move { + /// let input_stream = std::pin::pin!(streem::try_from_fn(|yielder| async move { /// # for i in 0..10 { /// # let value = fallible_fn(i)?; /// # @@ -70,7 +70,7 @@ impl Streamer { /// # /// # Ok(()) as Result<_, String> /// })); - /// use streaming::IntoStreamer; + /// use streem::IntoStreamer; /// /// let mut streamer = input_stream.into_streamer(); ///