My struct UdpSocketBuffer
has the following new
method:
pub fn new<MS, PS>(metadata_storage: MS, payload_storage: PS) -> PacketBuffer<'a, 'b, H>
where MS: Into<ManagedSlice<'a, PacketMetadata<H>>>,
PS: Into<ManagedSlice<'b, u8>>,
{
I'm passing, as arguments:
let rx_buffer = UdpSocketBuffer::new(Vec::new(), vec![0, 1024]);
let tx_buffer = UdpSocketBuffer::new(Vec::new(), vec![0, 1024]);
Here's how the conversion happens:
impl<'a, T: 'a> From<Vec<T>> for ManagedSlice<'a, T> {
fn from(value: Vec<T>) -> Self {
ManagedSlice::Owned(value)
}
}
I'm getting the error:
literal out of range for
u8rustc(overflowing_literals)
for the 1024
number. But I thought that the 0
is the value, and 1024
is just how many of 0
s the vector will begin with. Why is Rust interpreting 1024
as u8
?