Struct rotary::io::Write [−][src]
Make a mutable buffer into a write adapter that implements WriteBuf.
Examples
use rotary::{Buf as _, BufMut as _, ReadBuf as _, WriteBuf as _}; use rotary::io::{Read, Write, copy_remaining}; let from = rotary::interleaved![[1.0f32, 2.0f32, 3.0f32, 4.0f32]; 2]; let to = rotary::interleaved![[0.0f32; 4]; 2]; let mut to = Write::new(to); let mut from = Read::new(from.skip(2)); assert_eq!(to.remaining_mut(), 4); copy_remaining(from, &mut to); assert_eq!(to.remaining_mut(), 2); assert_eq! { to.as_ref().as_slice(), &[3.0, 3.0, 4.0, 4.0, 0.0, 0.0, 0.0, 0.0], };
Implementations
impl<B> Write<B> where
B: ExactSizeBuf,
[src]
B: ExactSizeBuf,
pub fn new(buf: B) -> Self
[src]
Construct a new write adapter.
pub fn as_ref(&self) -> &B
[src]
Access the underlying buffer.
Examples
use rotary::Buf as _; use rotary::io; let buffer: rotary::Interleaved<i16> = rotary::interleaved![[1, 2, 3, 4]; 4]; let mut buffer = io::Write::new(buffer); io::copy_remaining(rotary::wrap::interleaved(&[0i16; 16][..], 4), &mut buffer); assert_eq!(buffer.as_ref().channels(), 4);
pub fn as_mut(&mut self) -> &mut B
[src]
Access the underlying buffer mutably.
Examples
use rotary::Buf as _; use rotary::io; let buffer: rotary::Interleaved<i16> = rotary::interleaved![[1, 2, 3, 4]; 4]; let mut buffer = io::Write::new(buffer); io::copy_remaining(rotary::wrap::interleaved(&[0i16; 16][..], 4), &mut buffer); buffer.as_mut().resize_channels(2); assert_eq!(buffer.channels(), 2);
pub fn into_inner(self) -> B
[src]
Convert into the underlying buffer.
Examples
use rotary::Buf as _; use rotary::io; let buffer: rotary::Interleaved<i16> = rotary::interleaved![[1, 2, 3, 4]; 4]; let mut buffer = io::Write::new(buffer); io::copy_remaining(rotary::wrap::interleaved(&[0i16; 16][..], 4), &mut buffer); let buffer = buffer.into_inner(); assert_eq!(buffer.channels(), 4);
Trait Implementations
impl<B, T> Buf<T> for Write<B> where
B: Buf<T>,
[src]
B: Buf<T>,
fn frames_hint(&self) -> Option<usize>
[src]
fn channels(&self) -> usize
[src]
fn channel(&self, channel: usize) -> Channel<'_, T>
[src]
pub fn skip(self, n: usize) -> Skip<Self>
[src]
pub fn tail(self, n: usize) -> Tail<Self>
[src]
pub fn limit(self, limit: usize) -> Limit<Self>
[src]
pub fn chunk(self, n: usize, len: usize) -> Chunk<Self>
[src]
impl<B, T> BufMut<T> for Write<B> where
B: BufMut<T>,
[src]
B: BufMut<T>,
fn channel_mut(&mut self, channel: usize) -> ChannelMut<'_, T>
[src]
impl<B> ExactSizeBuf for Write<B> where
B: ExactSizeBuf,
[src]
B: ExactSizeBuf,
impl<B> WriteBuf for Write<B>
[src]
fn remaining_mut(&self) -> usize
[src]
Remaining number of frames available.
fn advance_mut(&mut self, n: usize)
[src]
pub fn has_remaining_mut(&self) -> bool
[src]
Auto Trait Implementations
impl<B> RefUnwindSafe for Write<B> where
B: RefUnwindSafe,
B: RefUnwindSafe,
impl<B> Send for Write<B> where
B: Send,
B: Send,
impl<B> Sync for Write<B> where
B: Sync,
B: Sync,
impl<B> Unpin for Write<B> where
B: Unpin,
B: Unpin,
impl<B> UnwindSafe for Write<B> where
B: UnwindSafe,
B: UnwindSafe,
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, 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>,