Skip to content

Commit

Permalink
fix doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico Chatzi committed Sep 23, 2023
1 parent 3163919 commit 60e2ed3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion aud/lib/src/audio/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl AudioBuffer {
/// ```
/// use aud_lib::audio::AudioBuffer;
///
/// let buffer = AudioBuffer::with_len(20, 2);
/// let buffer = AudioBuffer::with_length(20, 2);
/// assert_eq!(buffer.data.len(), 20); // Total number of samples
/// assert_eq!(buffer.num_channels, 2);
/// ```
Expand Down
10 changes: 4 additions & 6 deletions aud/lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ pub mod dsp {
/// ```rust
/// use aud_lib::dsp::deinterleave;
///
/// let interleaved = vec![1.0, 2.0, 3.0, 4.0]; // Assuming 2 channels
/// let interleaved = [1.0, 2.0, 3.0, 4.0]; // Assuming 2 channels
/// let deinterleaved = deinterleave(&interleaved, 2);
/// assert_eq!(deinterleaved, vec![vec![1.0, 3.0], vec![2.0, 4.0]]);
/// assert_eq!(deinterleaved, &[&[1.0, 3.0], &[2.0, 4.0]]);
/// ```
#[inline]
pub fn deinterleave(buffer: &[f32], num_channels: usize) -> Vec<Vec<f32>> {
Expand Down Expand Up @@ -60,10 +60,8 @@ pub mod dsp {
/// ```rust
/// use aud_lib::dsp::interleave;
///
/// let channels = vec![vec![1.0, 3.0], vec![2.0, 4.0]];
/// let interleaved: Vec<_> = channels.iter().map(AsRef::as_ref).collect();
/// let interleaved_buffer = interleave(&interleaved);
/// assert_eq!(interleaved_buffer, vec![1.0, 2.0, 3.0, 4.0]);
/// let interleaved_buffer = interleave(&[&[1.0, 3.0], &[2.0, 4.0]]);
/// assert_eq!(interleaved_buffer, &[1.0, 2.0, 3.0, 4.0]);
/// ```
#[inline]
pub fn interleave(buffer: &[impl AsRef<[f32]>]) -> Vec<f32> {
Expand Down

0 comments on commit 60e2ed3

Please sign in to comment.