PacketQueue::new() uses ::init() when in nightly
This commit is contained in:
parent
90f2939bf6
commit
c1e93c0904
@ -30,13 +30,24 @@ pub struct PacketQueue<const TX: usize, const RX: usize> {
|
|||||||
|
|
||||||
impl<const TX: usize, const RX: usize> PacketQueue<TX, RX> {
|
impl<const TX: usize, const RX: usize> PacketQueue<TX, RX> {
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
const NEW_TDES: TDes = TDes::new();
|
#[cfg(feature = "nightly")]
|
||||||
const NEW_RDES: RDes = RDes::new();
|
{
|
||||||
Self {
|
let mut this = core::mem::MaybeUninit::uninit();
|
||||||
tx_desc: [NEW_TDES; TX],
|
unsafe {
|
||||||
rx_desc: [NEW_RDES; RX],
|
Self::init(&mut this);
|
||||||
tx_buf: [Packet([0; TX_BUFFER_SIZE]); TX],
|
this.assume_init()
|
||||||
rx_buf: [Packet([0; RX_BUFFER_SIZE]); RX],
|
}
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "nightly"))]
|
||||||
|
{
|
||||||
|
const NEW_TDES: TDes = TDes::new();
|
||||||
|
const NEW_RDES: RDes = RDes::new();
|
||||||
|
Self {
|
||||||
|
tx_desc: [NEW_TDES; TX],
|
||||||
|
rx_desc: [NEW_RDES; RX],
|
||||||
|
tx_buf: [Packet([0; TX_BUFFER_SIZE]); TX],
|
||||||
|
rx_buf: [Packet([0; RX_BUFFER_SIZE]); RX],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user