Struct stm32_hal2::dma::DMAFrame [−][src]
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
impl<N> DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>,
[src]
N: ArrayLength<MaybeUninit<u8>>,
pub fn new() -> Self
[src]
Creates a new node for the Serial DMA
pub fn write(&mut self) -> &mut [u8]
[src]
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.
pub fn commit(&mut self, shrink_to: usize)
[src]
Used to shrink the current size of the frame, used in conjunction with write
.
pub fn write_uninit(&mut self) -> &mut [MaybeUninit<u8>]
[src]
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.
pub unsafe fn set_len(&mut self, len: usize)
[src]
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.
pub fn write_slice(&mut self, buf: &[u8]) -> usize
[src]
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.
pub fn clear(&mut self)
[src]
Clear the node of all data making it empty
pub fn read(&self) -> &[u8]
[src]
Returns a readable slice which maps to the buffers internal data
pub fn read_mut(&mut self) -> &mut [u8]
[src]
Returns a readable mutable slice which maps to the buffers internal data
pub fn len(&self) -> usize
[src]
Reads how many bytes are available
pub fn free(&self) -> usize
[src]
Reads how many bytes are free
pub fn max_len(&self) -> usize
[src]
Get the max length of the frame
pub fn is_empty(&self) -> bool
[src]
Checks if the frame is empty
Trait Implementations
impl<N> AsSlice for DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>,
[src]
N: ArrayLength<MaybeUninit<u8>>,
impl<N> Debug for DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>,
[src]
N: ArrayLength<MaybeUninit<u8>>,
impl<N> Default for DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>,
[src]
N: ArrayLength<MaybeUninit<u8>>,
impl<N> Write for DMAFrame<N> where
N: ArrayLength<MaybeUninit<u8>>,
[src]
N: ArrayLength<MaybeUninit<u8>>,
Auto Trait Implementations
impl<N> Send for DMAFrame<N>
impl<N> Sync for DMAFrame<N>
impl<N> Unpin for DMAFrame<N> where
<N as ArrayLength<MaybeUninit<u8>>>::ArrayType: Unpin,
<N as ArrayLength<MaybeUninit<u8>>>::ArrayType: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,