Skip to content

Commit

Permalink
create_stream -> stream_fn
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Oct 8, 2024
1 parent 73e9cd4 commit 0a2ae8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Features:
use futures_lite::stream;
use std::pin::pin;

let stream = pin!(asynk_strim::strim_fn(|mut yielder| async move {
let stream = pin!(asynk_strim::stream_fn(|mut yielder| async move {
yielder.yield_item("hello world!").await;
yielder.yield_item("pretty neato, ain't it?").await;
}));
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ where
/// # use futures_lite::StreamExt;
/// # use std::pin::pin;
/// # futures_lite::future::block_on(async {
/// let stream = asynk_strim::create_stream(|mut yielder| async move {
/// let stream = asynk_strim::stream_fn(|mut yielder| async move {
/// yielder.yield_item("Fahr den Imsi-Catcher hoch").await;
/// yielder.yield_item("Mach das Richtmikro an").await;
/// yielder.yield_item("Bring Alexa auf den Markt").await;
Expand All @@ -66,7 +66,7 @@ where
/// }
/// # });
#[inline]
pub fn create_stream<F, Item, Fut>(func: F) -> impl Stream<Item = Item>
pub fn stream_fn<F, Item, Fut>(func: F) -> impl Stream<Item = Item>
where
F: FnOnce(Yielder<Item>) -> Fut,
Fut: Future<Output = ()>,
Expand All @@ -83,5 +83,5 @@ where
F: FnOnce(Yielder<Item>) -> Fut,
Fut: Future<Output = ()>,
{
create_stream(func)
stream_fn(func)
}

0 comments on commit 0a2ae8f

Please sign in to comment.