Struct audio::channel::linear::LinearChannelMut
source · pub struct LinearChannelMut<'a, T> { /* private fields */ }
Expand description
Read-write access to a single channel of audio within a linear, multichannel audio buffer. This struct does not own the audio data; it provides an API for accessing data owned by something else.
See also crate::buf::Sequential.
Implementations§
source§impl<'a, T> LinearChannelMut<'a, T>
impl<'a, T> LinearChannelMut<'a, T>
sourcepub fn new(buf: &'a mut [T]) -> Self
pub fn new(buf: &'a mut [T]) -> Self
Construct a linear channel buffer.
The buffer provided as-is constitutes the frames of the channel.
Examples
use audio::channel::LinearChannelMut;
let buf: &mut [u32] = &mut [1, 3, 5, 7];
let channel = LinearChannelMut::new(buf);
assert_eq!(channel.iter().nth(1), Some(3));
assert_eq!(channel.iter().nth(2), Some(5));
sourcepub fn get_mut(&mut self, n: usize) -> Option<&mut T>
pub fn get_mut(&mut self, n: usize) -> Option<&mut T>
Get a mutable reference to the given frame.
Trait Implementations§
source§impl<T> AsMut<[T]> for LinearChannelMut<'_, T>
impl<T> AsMut<[T]> for LinearChannelMut<'_, T>
source§impl<'a, T> Channel for LinearChannelMut<'a, T>where
T: Copy,
impl<'a, T> Channel for LinearChannelMut<'a, T>where
T: Copy,
§type Channel<'this> = LinearChannel<'this, <LinearChannelMut<'a, T> as Channel>::Sample>
where
Self: 'this
type Channel<'this> = LinearChannel<'this, <LinearChannelMut<'a, T> as Channel>::Sample> where Self: 'this
The type the channel assumes when coerced into a reference.
§type Iter<'this> = Iter<'this, <LinearChannelMut<'a, T> as Channel>::Sample>
where
Self: 'this
type Iter<'this> = Iter<'this, <LinearChannelMut<'a, T> as Channel>::Sample> where Self: 'this
A borrowing iterator over the channel.
source§fn as_channel(&self) -> Self::Channel<'_>
fn as_channel(&self) -> Self::Channel<'_>
Reborrow the current channel as a reference.
source§fn len(&self) -> usize
fn len(&self) -> usize
Get the length which indicates number of frames in the current channel. Read more
source§fn get(&self, n: usize) -> Option<Self::Sample>
fn get(&self, n: usize) -> Option<Self::Sample>
Get the frame at the given offset in the channel. Read more
source§fn skip(self, n: usize) -> Self
fn skip(self, n: usize) -> Self
Construct a channel buffer where the first
n
frames are skipped. Read moresource§fn tail(self, n: usize) -> Self
fn tail(self, n: usize) -> Self
Construct a channel buffer where the last
n
frames are included. Read moresource§fn limit(self, limit: usize) -> Self
fn limit(self, limit: usize) -> Self
Limit the channel bufferto
limit
number of frames. Read moresource§impl<'a, T> ChannelMut for LinearChannelMut<'a, T>where
T: Copy,
impl<'a, T> ChannelMut for LinearChannelMut<'a, T>where
T: Copy,
§type ChannelMut<'this> = LinearChannelMut<'this, T>
where
Self: 'this
type ChannelMut<'this> = LinearChannelMut<'this, T> where Self: 'this
A reborrowed mutable channel.
source§fn as_channel_mut(&mut self) -> Self::ChannelMut<'_>
fn as_channel_mut(&mut self) -> Self::ChannelMut<'_>
Reborrow the channel mutably.
source§fn get_mut(&mut self, n: usize) -> Option<&mut Self::Sample>
fn get_mut(&mut self, n: usize) -> Option<&mut Self::Sample>
Get the frame at the given offset in the channel. Read more
source§impl<T> Debug for LinearChannelMut<'_, T>where
T: Debug,
impl<T> Debug for LinearChannelMut<'_, T>where
T: Debug,
source§impl<'a, T: Hash> Hash for LinearChannelMut<'a, T>
impl<'a, T: Hash> Hash for LinearChannelMut<'a, T>
source§impl<T, I> Index<I> for LinearChannelMut<'_, T>where
I: SliceIndex<[T]>,
impl<T, I> Index<I> for LinearChannelMut<'_, T>where
I: SliceIndex<[T]>,
source§impl<T, I> IndexMut<I> for LinearChannelMut<'_, T>where
I: SliceIndex<[T]>,
impl<T, I> IndexMut<I> for LinearChannelMut<'_, T>where
I: SliceIndex<[T]>,
source§impl<T> LinearChannel for LinearChannelMut<'_, T>where
T: Copy,
impl<T> LinearChannel for LinearChannelMut<'_, T>where
T: Copy,
source§fn as_linear_channel(&self) -> &[Self::Sample]
fn as_linear_channel(&self) -> &[Self::Sample]
Access the linear channel.
source§impl<T> LinearChannelMut for LinearChannelMut<'_, T>where
T: Copy,
impl<T> LinearChannelMut for LinearChannelMut<'_, T>where
T: Copy,
source§fn as_linear_channel_mut(&mut self) -> &mut [Self::Sample]
fn as_linear_channel_mut(&mut self) -> &mut [Self::Sample]
Access the linear channel mutably.
source§impl<'a, T: Ord> Ord for LinearChannelMut<'a, T>
impl<'a, T: Ord> Ord for LinearChannelMut<'a, T>
source§fn cmp(&self, other: &LinearChannelMut<'a, T>) -> Ordering
fn cmp(&self, other: &LinearChannelMut<'a, T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<'a, T> PartialEq<&[T]> for LinearChannelMut<'a, T>
impl<'a, T> PartialEq<&[T]> for LinearChannelMut<'a, T>
source§impl<'a, T> PartialEq<[T]> for LinearChannelMut<'a, T>
impl<'a, T> PartialEq<[T]> for LinearChannelMut<'a, T>
source§impl<'a, T> PartialEq<Vec<T>> for LinearChannelMut<'a, T>
impl<'a, T> PartialEq<Vec<T>> for LinearChannelMut<'a, T>
source§impl<'a, T: PartialEq> PartialEq for LinearChannelMut<'a, T>
impl<'a, T: PartialEq> PartialEq for LinearChannelMut<'a, T>
source§fn eq(&self, other: &LinearChannelMut<'a, T>) -> bool
fn eq(&self, other: &LinearChannelMut<'a, T>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'a, T> PartialOrd<&[T]> for LinearChannelMut<'a, T>where
T: Copy + PartialOrd,
impl<'a, T> PartialOrd<&[T]> for LinearChannelMut<'a, T>where
T: Copy + PartialOrd,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a, T> PartialOrd<[T]> for LinearChannelMut<'a, T>where
T: Copy + PartialOrd,
impl<'a, T> PartialOrd<[T]> for LinearChannelMut<'a, T>where
T: Copy + PartialOrd,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a, T, const N: usize> PartialOrd<[T; N]> for LinearChannelMut<'a, T>where
T: Copy + PartialOrd,
impl<'a, T, const N: usize> PartialOrd<[T; N]> for LinearChannelMut<'a, T>where
T: Copy + PartialOrd,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a, T> PartialOrd<Vec<T>> for LinearChannelMut<'a, T>where
T: Copy + PartialOrd,
impl<'a, T> PartialOrd<Vec<T>> for LinearChannelMut<'a, T>where
T: Copy + PartialOrd,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a, T: PartialOrd> PartialOrd for LinearChannelMut<'a, T>
impl<'a, T: PartialOrd> PartialOrd for LinearChannelMut<'a, T>
source§fn partial_cmp(&self, other: &LinearChannelMut<'a, T>) -> Option<Ordering>
fn partial_cmp(&self, other: &LinearChannelMut<'a, T>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<'a, T: Eq> Eq for LinearChannelMut<'a, T>
impl<'a, T> StructuralEq for LinearChannelMut<'a, T>
impl<'a, T> StructuralPartialEq for LinearChannelMut<'a, T>
Auto Trait Implementations§
impl<'a, T> RefUnwindSafe for LinearChannelMut<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for LinearChannelMut<'a, T>where
T: Send,
impl<'a, T> Sync for LinearChannelMut<'a, T>where
T: Sync,
impl<'a, T> Unpin for LinearChannelMut<'a, T>
impl<'a, T> !UnwindSafe for LinearChannelMut<'a, T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more