WriteView

Struct WriteView 

Source
pub struct WriteView<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> {
    pub slices: (&'a mut [T], &'a mut [T]),
    /* private fields */
}
Expand description

View into the writable portion of the buffer.

Fields§

§slices: (&'a mut [T], &'a mut [T])

Implementations§

Source§

impl<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> WriteView<'a, T, PW, CW>

Source

pub fn produce(self, amnt: usize)

Produces the specified number of items, making them available to the receiver.

The remaining elements are dropped.

amnt is clamped to the number of items in this view.

Source

pub fn iter(&mut self) -> Chain<IterMut<'_, T>, IterMut<'_, T>>

Iterates through each available slot, in order.

Equivalent to chaining the two slice’s iterators.

Source

pub fn is_empty(&self) -> bool

Checks if the view is empty.

Equivalent to testing if the first slices is empty. If the first slice is empty, the second one will be as well.

Source

pub fn len(&self) -> usize

Gets the length of the view.

This is the sum of the lengths of both slices.

Source

pub fn get(&mut self, i: usize) -> Option<&mut T>

Gets an item from the view, at the i’th place, or None if out of bounds.

Mimics slice::get_mut.

Trait Implementations§

Source§

impl<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> Deref for WriteView<'a, T, PW, CW>

Source§

type Target = (&'a mut [T], &'a mut [T])

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> DerefMut for WriteView<'a, T, PW, CW>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> Drop for WriteView<'a, T, PW, CW>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> Index<usize> for WriteView<'a, T, PW, CW>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, i: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, T, PW: OptionalWaiter, CW: OptionalWaiter> IndexMut<usize> for WriteView<'a, T, PW, CW>

Source§

fn index_mut(&mut self, i: usize) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<'a, T, PW, CW> Freeze for WriteView<'a, T, PW, CW>

§

impl<'a, T, PW, CW> RefUnwindSafe for WriteView<'a, T, PW, CW>

§

impl<'a, T, PW, CW> Send for WriteView<'a, T, PW, CW>
where T: Send,

§

impl<'a, T, PW, CW> Sync for WriteView<'a, T, PW, CW>
where T: Send + Sync,

§

impl<'a, T, PW, CW> Unpin for WriteView<'a, T, PW, CW>

§

impl<'a, T, PW, CW> !UnwindSafe for WriteView<'a, T, PW, CW>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.