embassy-stm32

Crates

git

Versions

stm32h7r3a8

Flavors

๐Ÿ“ฃ We want to hear from you! Fill the Rust Embedded 2024 micro-survey.

Struct embassy_stm32::eth::PacketQueue

source ยท
pub struct PacketQueue<const TX: usize, const RX: usize> { /* private fields */ }
Expand description

Ethernet packet queue.

This struct owns the memory used for reading and writing packets.

TX is the number of packets in the transmit queue, RX in the receive queue. A bigger queue allows the hardware to receive more packets while the CPU is busy doing other things, which may increase performance (especially for RX) at the cost of more RAM usage.

Implementationsยง

sourceยง

impl<const TX: usize, const RX: usize> PacketQueue<TX, RX>

source

pub const fn new() -> Self

Create a new packet queue.

source

pub fn init(this: &mut MaybeUninit<Self>)

Initialize a packet queue in-place.

This can be helpful to avoid accidentally stack-allocating the packet queue in the stack. The Rust compiler can sometimes be a bit dumb when working with large owned values: if you call new() and then store the returned PacketQueue in its final place (like a static), the compiler might place it temporarily on the stack then move it. Since this struct is quite big, it may result in a stack overflow.

With this function, you can create an uninitialized static with type MaybeUninit<PacketQueue<...>> and initialize it in-place, guaranteeing no stack usage.

After calling this function, calling assume_init on the MaybeUninit is guaranteed safe.

Auto Trait Implementationsยง

ยง

impl<const TX: usize, const RX: usize> !Freeze for PacketQueue<TX, RX>

ยง

impl<const TX: usize, const RX: usize> !RefUnwindSafe for PacketQueue<TX, RX>

ยง

impl<const TX: usize, const RX: usize> Send for PacketQueue<TX, RX>

ยง

impl<const TX: usize, const RX: usize> !Sync for PacketQueue<TX, RX>

ยง

impl<const TX: usize, const RX: usize> Unpin for PacketQueue<TX, RX>

ยง

impl<const TX: usize, const RX: usize> UnwindSafe for PacketQueue<TX, RX>

Blanket Implementationsยง

sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
sourceยง

impl<T> From<T> for T

sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.