[−][src]Struct spsc_bip_buffer::BipBufferWriterReservation
A write reservation returned by reserve
or spin_reserve
. The sender can access the reserved
buffer slice by dererferencing this reservation. Its size is guaranteed to match the requested
length in reserve
or spin_reserve
.
There are no guarantees on the contents of the buffer slice when a new reservation is created: the slice may contain stale data or garbage.
Dropping the reservation (or calling send
, which consumes self
) marks the end of the write
and informs the reader that the data in this slice can now be read.
Don't drop the reservation before you're done writing!
Examples
use spsc_bip_buffer::bip_buffer_from; let (mut writer, _) = bip_buffer_from(vec![0u8; 1024]); std::thread::spawn(move || { let mut reservation = writer.spin_reserve(4); reservation[0] = 0xf0; reservation[1] = 0x0f; reservation[2] = 0x00; reservation[3] = 0xee; reservation.send(); }).join().unwrap();
use spsc_bip_buffer::bip_buffer_from; let (mut writer, _) = bip_buffer_from(vec![0u8; 1024]); std::thread::spawn(move || { let mut reservation = writer.spin_reserve(4); let data = vec![0xf0, 0x0f, 0x00, 0xee]; reservation.copy_from_slice(&data[..]); // drop reservation, which sends data }).join().unwrap();
Methods
impl<'a> BipBufferWriterReservation<'a>
[src]
pub fn send(self)
[src]
Calling send
(or simply dropping the reservation) marks the end of the write and informs
the reader that the data in this slice can now be read.
Trait Implementations
impl<'a> Drop for BipBufferWriterReservation<'a>
[src]
impl<'a> DerefMut for BipBufferWriterReservation<'a>
[src]
impl<'a> Deref for BipBufferWriterReservation<'a>
[src]
Auto Trait Implementations
impl<'a> Send for BipBufferWriterReservation<'a>
impl<'a> !Sync for BipBufferWriterReservation<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,