You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently there is two lambdas that converts u32 and u64 into an array:
fn from(val:RawNtpPacket) -> Self{// left it here for a while, maybe in future Rust releases there// will be a way to use such a generic function with compile-time// size determination// const fn to_array<T: Sized>(x: &[u8]) -> [u8; mem::size_of::<T>()] {// let mut temp_buf = [0u8; mem::size_of::<T>()];//// temp_buf.copy_from_slice(x);// temp_buf// }let to_array_u32 = |x:&[u8]| {letmut temp_buf = [0u8; mem::size_of::<u32>()];
temp_buf.copy_from_slice(x);
temp_buf
};let to_array_u64 = |x:&[u8]| {letmut temp_buf = [0u8; mem::size_of::<u64>()];
temp_buf.copy_from_slice(x);
temp_buf
};
Describe the solution you'd like
When this rust-lang/rust#43408 would be resolved let's update the implementation with generic size_of::<T>() usage.
Describe alternatives you've considered
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Currently there is two lambdas that converts
u32
andu64
into an array:Describe the solution you'd like
When this rust-lang/rust#43408 would be resolved let's update the implementation with generic
size_of::<T>()
usage.Describe alternatives you've considered
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: