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> {
|
||||
pub const fn new() -> Self {
|
||||
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],
|
||||
#[cfg(feature = "nightly")]
|
||||
{
|
||||
let mut this = core::mem::MaybeUninit::uninit();
|
||||
unsafe {
|
||||
Self::init(&mut this);
|
||||
this.assume_init()
|
||||
}
|
||||
}
|
||||
#[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