diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-12-18 15:41:24 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-12-18 16:11:39 +0100 |
commit | 0f90387776f238cfdd818e33aa26a6d95dd6b3b9 (patch) | |
tree | 558a22eaf189dcad4f73de8c4621ca34e1a4321c | |
parent | 05eee5615ab656fa8a8829b0c3a4bb6a5b29368d (diff) |
Move Client object into NodeStreamBuilder::into_stream() for less complex calling
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | cli/src/profile.rs | 2 | ||||
-rw-r--r-- | lib/src/stream.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/cli/src/profile.rs b/cli/src/profile.rs index a0025b6..a3cfb07 100644 --- a/cli/src/profile.rs +++ b/cli/src/profile.rs @@ -112,7 +112,7 @@ async fn profile_cat(matches: &ArgMatches) -> Result<()> { if let Some(head) = profile.head() { log::info!("Profile HEAD = {:?}", head); NodeStreamBuilder::starting_from(head.clone()) - .into_stream(profile.client()) + .into_stream(profile.client().clone()) .then(|node| async { match node { Err(e) => Err(e), diff --git a/lib/src/stream.rs b/lib/src/stream.rs index 01548e6..2dd2781 100644 --- a/lib/src/stream.rs +++ b/lib/src/stream.rs @@ -15,7 +15,7 @@ impl NodeStreamBuilder { } } - pub fn into_stream<'a>(self, client: &'a Client) -> impl futures::stream::Stream<Item = Result<Node>> + 'a { + pub fn into_stream(self, client: Client) -> impl futures::stream::Stream<Item = Result<Node>> { futures::stream::unfold((client, self.state), move |(client, mut state)| { async move { if let Some(node_cid) = state.pop() { |