Commit a5e027e 1 parent bc70f92 commit a5e027e Copy full SHA for a5e027e
File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1654,8 +1654,23 @@ pub fn from_slice<T: BorshDeserialize>(v: &[u8]) -> Result<T> {
1654
1654
/// ```
1655
1655
#[ async_generic(
1656
1656
#[ cfg( feature = "unstable__async" ) ]
1657
- async_signature[ impl_fut] <' a, R : AsyncRead , T : BorshDeserializeAsync + ' a>( reader: & ' a mut R ) -> impl Future <Output =Result <T >> + Send + ' a
1657
+ async_signature[ impl_fut] <R : AsyncRead , T : BorshDeserializeAsync >(
1658
+ reader: & mut R ,
1659
+ ) -> impl Future <Output =Result <T >> + Send + Captures <& mut R >
1658
1660
) ]
1659
1661
pub fn from_reader < R : Read , T : BorshDeserialize > ( reader : & mut R ) -> Result < T > {
1660
1662
T :: try_from_reader ( reader)
1661
1663
}
1664
+
1665
+ use captures:: Captures ;
1666
+ mod captures {
1667
+ /// This is a [trick](https://github.com/rust-lang/rfcs/blob/master/text/3498-lifetime-capture-rules-2024.md#the-captures-trick),
1668
+ /// used to not over-restrict the lifetime and trait bounds of a RPIT.
1669
+ ///
1670
+ /// Once the MSRV is >=1.82, this should be removed and replaced with `use<>`
1671
+ /// notation for precise capturing.
1672
+ #[ doc( hidden) ]
1673
+ pub trait Captures < T : ?Sized > { }
1674
+
1675
+ impl < T : ?Sized , U : ?Sized > Captures < T > for U { }
1676
+ }
You can’t perform that action at this time.
0 commit comments