@@ -1595,20 +1595,23 @@ pub mod __rt {
1595
1595
/// Wrapper around [`::once_cell::unsync::Lazy`] adding some compatibility methods with
1596
1596
/// [`std::thread::LocalKey`] and adding `Send + Sync` when `atomics` is not enabled.
1597
1597
#[ cfg( not( feature = "std" ) ) ]
1598
- pub struct LazyCell < T > ( :: once_cell:: unsync:: Lazy < T > ) ;
1598
+ pub struct LazyCell < T , F = fn ( ) -> T > ( :: once_cell:: unsync:: Lazy < T , F > ) ;
1599
1599
1600
1600
#[ cfg( all( not( target_feature = "atomics" ) , not( feature = "std" ) ) ) ]
1601
- unsafe impl < T > Sync for LazyCell < T > { }
1601
+ unsafe impl < T , F > Sync for LazyCell < T , F > { }
1602
1602
1603
1603
#[ cfg( all( not( target_feature = "atomics" ) , not( feature = "std" ) ) ) ]
1604
- unsafe impl < T > Send for LazyCell < T > { }
1604
+ unsafe impl < T , F > Send for LazyCell < T , F > { }
1605
1605
1606
1606
#[ cfg( not( feature = "std" ) ) ]
1607
- impl < T > LazyCell < T > {
1608
- pub const fn new ( init : fn ( ) -> T ) -> LazyCell < T > {
1607
+ impl < T , F > LazyCell < T , F > {
1608
+ pub const fn new ( init : F ) -> LazyCell < T , F > {
1609
1609
Self ( :: once_cell:: unsync:: Lazy :: new ( init) )
1610
1610
}
1611
+ }
1611
1612
1613
+ #[ cfg( not( feature = "std" ) ) ]
1614
+ impl < T , F : FnOnce ( ) -> T > LazyCell < T , F > {
1612
1615
pub ( crate ) fn try_with < R > (
1613
1616
& self ,
1614
1617
f : impl FnOnce ( & T ) -> R ,
0 commit comments