Struct stm32l4xx_hal::dma::DMAFrame
source · [−]pub struct DMAFrame<const N: usize> { /* private fields */ }
Expand description
Data type for holding data frames for the Serial.
Internally used uninitialized storage, making this storage zero cost to create. It can also be
used with, for example, heapless::pool
to create a pool of serial frames.
Implementations
sourceimpl<const N: usize> DMAFrame<N>
impl<const N: usize> DMAFrame<N>
sourcepub fn write(&mut self) -> &mut [u8]
pub fn write(&mut self) -> &mut [u8]
Gives a &mut [u8]
slice to write into with the maximum size, the commit
method
must then be used to set the actual number of bytes written.
Note that this function internally first zeros the uninitialized part of the node’s buffer.
sourcepub fn commit(&mut self, shrink_to: usize)
pub fn commit(&mut self, shrink_to: usize)
Used to shrink the current size of the frame, used in conjunction with write
.
sourcepub fn write_uninit(&mut self) -> &mut [MaybeUninit<u8>; N]
pub fn write_uninit(&mut self) -> &mut [MaybeUninit<u8>; N]
Gives an uninitialized &mut [MaybeUninit<u8>]
slice to write into, the set_len
method
must then be used to set the actual number of bytes written.
sourcepub unsafe fn set_len(&mut self, len: usize)
pub unsafe fn set_len(&mut self, len: usize)
Used to set the current size of the frame, used in conjunction with write_uninit
to have an
interface for uninitialized memory. Use with care!
Safety
NOTE(unsafe): This must be set so that the final buffer is only referencing initialized memory.
sourcepub fn write_slice(&mut self, buf: &[u8]) -> usize
pub fn write_slice(&mut self, buf: &[u8]) -> usize
Used to write data into the node, and returns how many bytes were written from buf
.
If the node is already partially filled, this will continue filling the node.
Trait Implementations
Auto Trait Implementations
impl<const N: usize> RefUnwindSafe for DMAFrame<N>
impl<const N: usize> Send for DMAFrame<N>
impl<const N: usize> Sync for DMAFrame<N>
impl<const N: usize> Unpin for DMAFrame<N>
impl<const N: usize> UnwindSafe for DMAFrame<N>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more