@@ -12,7 +12,7 @@ use embedded_graphics::{
1212 Drawable ,
1313} ;
1414use time:: OffsetDateTime ;
15- use zerocopy:: { AsBytes , BigEndian , FromBytes , FromZeroes , U16 } ;
15+ use zerocopy:: { BigEndian , FromBytes , Immutable , IntoBytes , KnownLayout , U16 } ;
1616
1717/// Message style configuration
1818/// ```
@@ -197,7 +197,7 @@ const MSG_PADDING_ALIGN: usize = 64;
197197
198198const MAGIC : [ u8 ; 6 ] = * b"wang\0 \0 " ;
199199
200- #[ derive( FromZeroes , FromBytes , AsBytes ) ]
200+ #[ derive( FromBytes , IntoBytes , Immutable , KnownLayout ) ]
201201#[ repr( C ) ]
202202struct Header {
203203 magic : [ u8 ; 6 ] ,
@@ -210,7 +210,7 @@ struct Header {
210210 _padding_2 : [ u8 ; 20 ] ,
211211}
212212
213- #[ derive( FromZeroes , FromBytes , AsBytes ) ]
213+ #[ derive( FromBytes , IntoBytes , Immutable , KnownLayout ) ]
214214#[ repr( C ) ]
215215struct Timestamp {
216216 year : u8 ,
@@ -297,7 +297,7 @@ impl PayloadBuffer {
297297 }
298298
299299 fn header_mut ( & mut self ) -> & mut Header {
300- Header :: mut_from_prefix ( & mut self . data ) . unwrap ( )
300+ Header :: mut_from_prefix ( & mut self . data ) . unwrap ( ) . 0
301301 }
302302
303303 /// Return the current number of messages
@@ -359,7 +359,7 @@ impl PayloadBuffer {
359359
360360 let start = self . data . len ( ) ;
361361 self . data . resize ( start + count * 11 , 0 ) ;
362- MessageBuffer ( FromBytes :: mut_slice_from ( & mut self . data [ start..] ) . unwrap ( ) )
362+ MessageBuffer ( FromBytes :: mut_from_bytes ( & mut self . data [ start..] ) . unwrap ( ) )
363363 }
364364
365365 /// Get the current payload as bytes (without padding)
0 commit comments