@@ -47,7 +47,7 @@ macro_rules! impl_get_le {
47
47
macro_rules! impl_set_le {
48
48
( $set: ident, $field: ident, $t: ty) => {
49
49
#[ inline]
50
- pub const fn $set( & mut self , val: $t) {
50
+ pub fn $set( & mut self , val: $t) {
51
51
self . $field = val. to_le_bytes( ) ;
52
52
}
53
53
} ;
@@ -92,7 +92,7 @@ macro_rules! impl_get {
92
92
macro_rules! impl_set {
93
93
( $set: ident, $field: ident, $t: ty) => {
94
94
#[ inline]
95
- pub const fn $set( & mut self , val: $t) {
95
+ pub fn $set( & mut self , val: $t) {
96
96
self . $field = val;
97
97
}
98
98
} ;
@@ -125,15 +125,16 @@ macro_rules! impl_set_with_get {
125
125
}
126
126
127
127
pub const fn const_assign_byte_arr < const A : usize , const START : usize , const LEN : usize > (
128
- arr : & mut [ u8 ; A ] ,
128
+ mut arr : [ u8 ; A ] ,
129
129
val : [ u8 ; LEN ] ,
130
- ) {
130
+ ) -> [ u8 ; A ] {
131
131
const {
132
132
assert ! ( START + LEN <= A ) ;
133
133
}
134
134
// safety: bounds checked at comptime above
135
135
unsafe {
136
136
// guarantee nonoverlapping due to `&mut`
137
- core:: ptr:: copy_nonoverlapping ( val. as_ptr ( ) , arr. as_ptr ( ) . add ( START ) . cast_mut ( ) , LEN ) ;
137
+ core:: ptr:: copy_nonoverlapping ( val. as_ptr ( ) , arr. as_mut_ptr ( ) . add ( START ) . cast ( ) , LEN ) ;
138
138
}
139
+ arr
139
140
}
0 commit comments