Skip to content

Commit 46695e5

Browse files
committed
Merge #335: Make FutureResult non-Send when no-std
936c724 fix(persisted): Make `FutureResult` non-`Send` when no-`std` (Fedeparma74) Pull request description: ### Description This PR updates the `FutureResult` type alias in the async persister implementation to support **non-`Send` futures** when the `std` feature is disabled. Previously, the `FutureResult` type always required the `Send` bound, which prevented `no_std` environments from using non-`Send` futures. With this change, the bound is applied only when the `std` feature is enabled. This improves compatibility for embedded or `no_std` targets while keeping full `Send` safety for standard environments. ### Notes to the reviewers The change is minimal and fully backwards compatible. It only affects compilation under `no_std` builds and does not modify any runtime behavior or APIs under the `std` feature. Please confirm that this approach aligns with the intended async API design and does not conflict with downstream usage expectations. ### Changelog notice #### Changed * Relaxed the `FutureResult` type alias to allow non-`Send` futures in `no_std` builds. ACKs for top commit: ValuedMammal: ACK 936c724 luisschwab: ACK 936c724 Tree-SHA512: 388922a023246be786c1d475d02d800ebf69be3759492ee4f20a7be47667a013bbd883742d838bf8479447fd19a0ec9d280d39d9da6c75d15700817f4c3280fe
2 parents 41c54da + 936c724 commit 46695e5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/wallet/persisted.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ pub trait WalletPersister {
5555
fn persist(persister: &mut Self, changeset: &ChangeSet) -> Result<(), Self::Error>;
5656
}
5757

58+
#[cfg(feature = "std")]
5859
type FutureResult<'a, T, E> = Pin<Box<dyn Future<Output = Result<T, E>> + Send + 'a>>;
60+
#[cfg(not(feature = "std"))]
61+
type FutureResult<'a, T, E> = Pin<Box<dyn Future<Output = Result<T, E>> + 'a>>;
5962

6063
/// Async trait that persists [`PersistedWallet`].
6164
///

0 commit comments

Comments
 (0)