File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1+ [toolchain ]
2+ channel = " nightly"
Original file line number Diff line number Diff line change 11#![ doc = include_str ! ( "../README.md" ) ]
22#![ cfg_attr( not( any( doc, test) ) , no_std) ]
3+ #![ feature( const_convert, const_trait_impl) ]
34
45use core:: any:: Any ;
56use core:: cell:: Cell ;
@@ -58,20 +59,26 @@ impl<T: Any> NonDeDuplicated<T> {
5859 }
5960}
6061
61- impl < T : Any > Deref for NonDeDuplicated < T > {
62+ impl < T : Any > const Deref for NonDeDuplicated < T > {
6263 type Target = T ;
6364
6465 fn deref ( & self ) -> & Self :: Target {
6566 self . get ( )
6667 }
6768}
6869
69- impl < T : Any > From < T > for NonDeDuplicated < T > {
70+ impl < T : Any > const From < T > for NonDeDuplicated < T > {
7071 fn from ( value : T ) -> Self {
7172 Self :: new ( value)
7273 }
7374}
7475
76+ impl < T : Any , const N : usize > NonDeDuplicated < [ T ; N ] > {
77+ pub const fn as_array_of_cells ( & self ) -> & [ NonDeDuplicated < T > ; N ] {
78+ unsafe { core:: mem:: transmute ( self . cell . as_array_of_cells ( ) ) }
79+ }
80+ }
81+
7582/// For now, [Sync] requires that `T` is both [Sync] AND [Send], following
7683/// [std::sync::Mutex](https://doc.rust-lang.org/nightly/std/sync/struct.Mutex.html#impl-Sync-for-Mutex%3CT%3E).
7784/// However, from <https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html> it seems that `T:
You can’t perform that action at this time.
0 commit comments