File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ mod spsc;
19
19
/// Types that can be used as `RingBuffer` indices: `u8`, `u16` and `usize
20
20
///
21
21
/// This trait is sealed and cannot be implemented outside of `heapless`.
22
- pub unsafe trait Uxx : Into < usize > + Send {
22
+ pub unsafe trait Uxx : Into < usize > + Send + private :: Sealed {
23
23
#[ doc( hidden) ]
24
24
fn truncate ( x : usize ) -> Self ;
25
25
@@ -54,6 +54,16 @@ pub unsafe trait Uxx: Into<usize> + Send {
54
54
fn store_release ( x : * mut Self , val : Self ) ;
55
55
}
56
56
57
+ mod private {
58
+ pub trait Sealed { }
59
+
60
+ impl Sealed for usize { }
61
+ #[ cfg( feature = "smaller-atomics" ) ]
62
+ impl Sealed for u8 { }
63
+ #[ cfg( feature = "smaller-atomics" ) ]
64
+ impl Sealed for u16 { }
65
+ }
66
+
57
67
#[ cfg( feature = "smaller-atomics" ) ]
58
68
unsafe impl Uxx for u8 {
59
69
fn truncate ( x : usize ) -> Self {
You can’t perform that action at this time.
0 commit comments