File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 3030#![ cfg_attr( not( test) , no_std) ]
3131
3232use core:: {
33+ borrow:: { Borrow , BorrowMut } ,
3334 cmp:: Ordering ,
3435 fmt:: { Debug , Display } ,
3536 hash:: { Hash , Hasher } ,
@@ -170,6 +171,44 @@ where
170171 }
171172}
172173
174+ impl < A , T > Borrow < T > for Aligned < A , T >
175+ where
176+ A : sealed:: Alignment ,
177+ {
178+ fn borrow ( & self ) -> & T {
179+ & self . value
180+ }
181+ }
182+
183+ impl < A , T > BorrowMut < T > for Aligned < A , T >
184+ where
185+ A : sealed:: Alignment ,
186+ {
187+ fn borrow_mut ( & mut self ) -> & mut T {
188+ & mut self . value
189+ }
190+ }
191+
192+ impl < A , T > Borrow < [ <Aligned < A , T > as AsSlice >:: Element ] > for Aligned < A , T >
193+ where
194+ A : sealed:: Alignment ,
195+ Aligned < A , T > : AsSlice ,
196+ {
197+ fn borrow ( & self ) -> & [ <Aligned < A , T > as AsSlice >:: Element ] {
198+ self . as_slice ( )
199+ }
200+ }
201+
202+ impl < A , T > BorrowMut < [ <Aligned < A , T > as AsSlice >:: Element ] > for Aligned < A , T >
203+ where
204+ A : sealed:: Alignment ,
205+ Aligned < A , T > : AsMutSlice ,
206+ {
207+ fn borrow_mut ( & mut self ) -> & mut [ <Aligned < A , T > as AsSlice >:: Element ] {
208+ self . as_mut_slice ( )
209+ }
210+ }
211+
173212impl < A , T > Clone for Aligned < A , T >
174213where
175214 A : Alignment ,
You can’t perform that action at this time.
0 commit comments