audio_core/frame_mut.rs
1//! A frame buffer as created through
2//! [UniformBuf::get_frame][crate::UniformBuf::get_frame].
3
4use crate::frame::Frame;
5
6/// The buffer of a single frame.
7pub trait FrameMut: Frame {
8 /// The type the frame assumes when coerced into a reference.
9 type FrameMut<'this>: FrameMut<Sample = Self::Sample>
10 where
11 Self: 'this;
12
13 /// A borrowing iterator over the channel.
14 type IterMut<'this>: Iterator<Item = &'this mut Self::Sample>
15 where
16 Self: 'this;
17
18 /// Reborrow the current frame as a reference.
19 fn as_sample_mut(&mut self) -> Self::FrameMut<'_>;
20
21 /// Get the sample mutable at the given channel in the frame.
22 fn get_mut(&mut self, channel: usize) -> Option<&mut Self::Sample>;
23
24 /// Construct a mutable iterator over the frame.
25 fn iter_mut(&mut self) -> Self::IterMut<'_>;
26}