This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

Work around async desugaring compiler bug

+18 -12
+2 -2
src/inliner.rs
··· 1 1 //! Inlining [`Ipld`][libipld::ipld::Ipld] from a content addressed store 2 2 mod at_least_once; 3 - // mod at_most_once; 3 + mod at_most_once; 4 4 mod traits; 5 5 6 6 pub use at_least_once::AtLeastOnce; 7 - // FIXME pub use at_most_once::AtMostOnce; 7 + pub use at_most_once::AtMostOnce; 8 8 pub use traits::{Inliner, Stuck};
+16 -10
src/inliner/at_most_once.rs
··· 4 4 AtLeastOnce, 5 5 }; 6 6 use crate::InlineIpld; 7 - use blockstore::Blockstore; 7 + use blockstore::{cond_send::CondSend, Blockstore}; 8 8 use ipld_core::{cid::Cid, ipld::Ipld}; 9 9 use std::collections::HashSet; 10 + use std::{future, future::Future, ops::DerefMut}; 10 11 11 12 /// [`Ipld`] inliner that only inlines a [`Cid`] at most once, if avalaible 12 13 /// ··· 66 67 self.at_least_once.resolve(ipld); 67 68 } 68 69 69 - fn run<S: Blockstore + ?Sized>(self, store: &S) -> Option<Result<InlineIpld, Stuck<Self>>> { 70 - match self.at_least_once.run(store)? { 71 - Ok(inline_ipld) => Some(Ok(inline_ipld)), 72 - Err(stuck) => { 73 - if self.seen.contains(&stuck.needs()) { 74 - let inliner: Self = (*stuck.ignore()).into(); 75 - inliner.run(store) 76 - } else { 77 - None 70 + fn run<S: Blockstore + ?Sized>( 71 + self, 72 + store: &S, 73 + ) -> impl Future<Output = Option<Result<InlineIpld, Stuck<Self>>>> + CondSend { 74 + async move { 75 + match self.at_least_once.run(store).await? { 76 + Ok(inline_ipld) => Some(Ok(inline_ipld)), 77 + Err(stuck) => { 78 + if self.seen.contains(&stuck.needs()) { 79 + let inliner: Self = (*stuck.ignore()).into(); 80 + inliner.run(store).await 81 + } else { 82 + None 83 + } 78 84 } 79 85 } 80 86 }