Struct sized_chunks::ring_buffer::RingBuffer
source · [−]pub struct RingBuffer<A, const N: usize> { /* private fields */ }
Expand description
A fixed capacity ring buffer.
A ring buffer is an array where the first logical index is at some arbitrary location inside the array, and the indices wrap around to the start of the array once they overflow its bounds.
This gives us the ability to push to either the front or the end of the array in constant time, at the cost of losing the ability to get a single contiguous slice reference to the contents.
It differs from the Chunk
in that the latter will have mostly
constant time pushes, but may occasionally need to shift its contents around
to make room. They both have constant time pop, and they both have linear
time insert and remove.
The RingBuffer
offers its own Slice
and SliceMut
types to compensate for the loss of being able to take a slice, but they’re
somewhat less efficient, so the general rule should be that you shouldn’t
choose a RingBuffer
if you rely heavily on slices - but if you don’t,
it’s probably a marginally better choice overall than Chunk
.
Feature Flag
To use this data structure, you need to enable the ringbuffer
feature.
Implementations
sourceimpl<A, const N: usize> RingBuffer<A, N>
impl<A, const N: usize> RingBuffer<A, N>
sourcepub fn drain_from(other: &mut Self) -> Self
pub fn drain_from(other: &mut Self) -> Self
Construct a new ring buffer and move every item from other
into the
new buffer.
Time: O(n)
sourcepub fn collect_from<I>(iter: &mut I, count: usize) -> Self where
I: Iterator<Item = A>,
pub fn collect_from<I>(iter: &mut I, count: usize) -> Self where
I: Iterator<Item = A>,
Construct a new ring buffer and populate it by taking count
items from
the iterator iter
.
Panics if the iterator contains less than count
items.
Time: O(n)
sourcepub fn from_front(other: &mut Self, count: usize) -> Self
pub fn from_front(other: &mut Self, count: usize) -> Self
Construct a new ring buffer and populate it by taking count
items from
the front of other
.
Time: O(n) for the number of items moved
sourcepub fn from_back(other: &mut Self, count: usize) -> Self
pub fn from_back(other: &mut Self, count: usize) -> Self
Construct a new ring buffer and populate it by taking count
items from
the back of other
.
Time: O(n) for the number of items moved
sourcepub fn iter(&self) -> Iter<'_, A, N>ⓘNotable traits for Iter<'a, A, N>impl<'a, A, const N: usize> Iterator for Iter<'a, A, N> type Item = &'a A;
pub fn iter(&self) -> Iter<'_, A, N>ⓘNotable traits for Iter<'a, A, N>impl<'a, A, const N: usize> Iterator for Iter<'a, A, N> type Item = &'a A;
Get an iterator over references to the items in the ring buffer in order.
sourcepub fn iter_mut(&mut self) -> IterMut<'_, A, N>ⓘNotable traits for IterMut<'a, A, N>impl<'a, A, const N: usize> Iterator for IterMut<'a, A, N> where
A: 'a, type Item = &'a mut A;
pub fn iter_mut(&mut self) -> IterMut<'_, A, N>ⓘNotable traits for IterMut<'a, A, N>impl<'a, A, const N: usize> Iterator for IterMut<'a, A, N> where
A: 'a, type Item = &'a mut A;
A: 'a, type Item = &'a mut A;
Get an iterator over mutable references to the items in the ring buffer in order.
sourcepub fn slice<R: RangeBounds<usize>>(&self, range: R) -> Slice<'_, A, N>
pub fn slice<R: RangeBounds<usize>>(&self, range: R) -> Slice<'_, A, N>
Get a Slice
for a subset of the ring buffer.
sourcepub fn slice_mut<R: RangeBounds<usize>>(
&mut self,
range: R
) -> SliceMut<'_, A, N>
pub fn slice_mut<R: RangeBounds<usize>>(
&mut self,
range: R
) -> SliceMut<'_, A, N>
Get a SliceMut
for a subset of the ring buffer.
sourcepub unsafe fn get_unchecked(&self, index: usize) -> &A
pub unsafe fn get_unchecked(&self, index: usize) -> &A
Get an unchecked reference to the value at the given index.
Safety
You must ensure the index is not out of bounds.
sourcepub unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut A
pub unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut A
Get an unchecked mutable reference to the value at the given index.
Safety
You must ensure the index is not out of bounds.
sourcepub fn push_back(&mut self, value: A)
pub fn push_back(&mut self, value: A)
Push a value to the back of the buffer.
Panics if the capacity of the buffer is exceeded.
Time: O(1)
sourcepub fn push_front(&mut self, value: A)
pub fn push_front(&mut self, value: A)
Push a value to the front of the buffer.
Panics if the capacity of the buffer is exceeded.
Time: O(1)
sourcepub fn pop_back(&mut self) -> Option<A>
pub fn pop_back(&mut self) -> Option<A>
Pop a value from the back of the buffer.
Returns None
if the buffer is empty.
Time: O(1)
sourcepub fn pop_front(&mut self) -> Option<A>
pub fn pop_front(&mut self) -> Option<A>
Pop a value from the front of the buffer.
Returns None
if the buffer is empty.
Time: O(1)
sourcepub fn drop_left(&mut self, index: usize)
pub fn drop_left(&mut self, index: usize)
Discard all items up to but not including index
.
Panics if index
is out of bounds.
Time: O(n) for the number of items dropped
sourcepub fn drop_right(&mut self, index: usize)
pub fn drop_right(&mut self, index: usize)
Discard all items from index
onward.
Panics if index
is out of bounds.
Time: O(n) for the number of items dropped
sourcepub fn split_off(&mut self, index: usize) -> Self
pub fn split_off(&mut self, index: usize) -> Self
Split a buffer into two, the original buffer containing
everything up to index
and the returned buffer containing
everything from index
onwards.
Panics if index
is out of bounds.
Time: O(n) for the number of items in the new buffer
sourcepub fn append(&mut self, other: &mut Self)
pub fn append(&mut self, other: &mut Self)
Remove all items from other
and append them to the back of self
.
Panics if the capacity of self
is exceeded.
other
will be an empty buffer after this operation.
Time: O(n) for the number of items moved
sourcepub fn drain_from_front(&mut self, other: &mut Self, count: usize)
pub fn drain_from_front(&mut self, other: &mut Self, count: usize)
Remove count
items from the front of other
and append them to the
back of self
.
Panics if self
doesn’t have count
items left, or if other
has
fewer than count
items.
Time: O(n) for the number of items moved
sourcepub fn drain_from_back(&mut self, other: &mut Self, count: usize)
pub fn drain_from_back(&mut self, other: &mut Self, count: usize)
Remove count
items from the back of other
and append them to the
front of self
.
Panics if self
doesn’t have count
items left, or if other
has
fewer than count
items.
Time: O(n) for the number of items moved
sourcepub fn insert(&mut self, index: usize, value: A)
pub fn insert(&mut self, index: usize, value: A)
Insert a new value at index index
, shifting all the following values
to the right.
Panics if the index is out of bounds.
Time: O(n) for the number of items shifted
sourcepub fn insert_ordered(&mut self, value: A) where
A: Ord,
pub fn insert_ordered(&mut self, value: A) where
A: Ord,
Insert a new value into the buffer in sorted order.
This assumes every element of the buffer is already in sorted order. If not, the value will still be inserted but the ordering is not guaranteed.
Time: O(log n) to find the insert position, then O(n) for the number of elements shifted.
sourcepub fn insert_from<Iterable, I>(&mut self, index: usize, iter: Iterable) where
Iterable: IntoIterator<Item = A, IntoIter = I>,
I: ExactSizeIterator<Item = A>,
pub fn insert_from<Iterable, I>(&mut self, index: usize, iter: Iterable) where
Iterable: IntoIterator<Item = A, IntoIter = I>,
I: ExactSizeIterator<Item = A>,
Insert multiple values at index index
, shifting all the following values
to the right.
Panics if the index is out of bounds or the chunk doesn’t have room for all the values.
Time: O(m+n) where m is the number of elements inserted and n is the number
of elements following the insertion index. Calling insert
repeatedly would be O(m*n).
sourcepub fn remove(&mut self, index: usize) -> A
pub fn remove(&mut self, index: usize) -> A
Remove the value at index index
, shifting all the following values to
the left.
Returns the removed value.
Panics if the index is out of bounds.
Time: O(n) for the number of items shifted
Trait Implementations
sourceimpl<'a, A, const N: usize> Arbitrary<'a> for RingBuffer<A, N> where
A: Arbitrary<'a>,
BitsImpl<N>: Bits,
impl<'a, A, const N: usize> Arbitrary<'a> for RingBuffer<A, N> where
A: Arbitrary<'a>,
BitsImpl<N>: Bits,
sourcefn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Generate an arbitrary value of Self
from the given unstructured data. Read more
sourcefn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self>
Generate an arbitrary value of Self
from the entirety of the given unstructured data. Read more
sourceimpl<A, const N: usize> Array for RingBuffer<A, N>
impl<A, const N: usize> Array for RingBuffer<A, N>
sourcefn contains(&self, target: &Self::Output) -> bool where
Self::Output: PartialEq<Self::Output>,
fn contains(&self, target: &Self::Output) -> bool where
Self::Output: PartialEq<Self::Output>,
Return true if an element equivalent to target
exists in the array.
sourcefn binary_search(&self, target: &Self::Output) -> Result<usize, usize> where
Self::Output: Ord,
fn binary_search(&self, target: &Self::Output) -> Result<usize, usize> where
Self::Output: Ord,
Perform a binary search for target
.
sourcefn binary_search_by<F>(&self, compare: F) -> Result<usize, usize> where
F: FnMut(&Self::Output) -> Ordering,
fn binary_search_by<F>(&self, compare: F) -> Result<usize, usize> where
F: FnMut(&Self::Output) -> Ordering,
Perform a binary search using a comparator function.
sourcefn binary_search_by_key<K, F>(
&self,
key: &K,
extract: F
) -> Result<usize, usize> where
F: FnMut(&Self::Output) -> K,
K: Ord,
fn binary_search_by_key<K, F>(
&self,
key: &K,
extract: F
) -> Result<usize, usize> where
F: FnMut(&Self::Output) -> K,
K: Ord,
Perform a binary search using a key and a key extractor function.
sourcefn is_sorted(&self) -> bool where
Self::Output: PartialOrd<Self::Output>,
fn is_sorted(&self) -> bool where
Self::Output: PartialOrd<Self::Output>,
Test whether the array is sorted.
sourcefn is_sorted_by<F>(&self, compare: F) -> bool where
F: FnMut(&Self::Output, &Self::Output) -> Option<Ordering>,
fn is_sorted_by<F>(&self, compare: F) -> bool where
F: FnMut(&Self::Output, &Self::Output) -> Option<Ordering>,
Test whether the array is sorted using a comparator function.
sourcefn is_sorted_by_key<K, F>(&self, extract: F) -> bool where
F: FnMut(&Self::Output) -> K,
K: PartialOrd<K>,
fn is_sorted_by_key<K, F>(&self, extract: F) -> bool where
F: FnMut(&Self::Output) -> K,
K: PartialOrd<K>,
Test whether the array is sorted using a key extractor function.
sourceimpl<A, const N: usize> ArrayMut for RingBuffer<A, N>
impl<A, const N: usize> ArrayMut for RingBuffer<A, N>
sourcefn get_mut(&mut self, index: usize) -> Option<&mut A>
fn get_mut(&mut self, index: usize) -> Option<&mut A>
Get a mutable reference to the value at a given index.
sourcefn first_mut(&mut self) -> Option<&mut Self::Output>
fn first_mut(&mut self) -> Option<&mut Self::Output>
Get a mutable reference to the first element in the array.
sourcefn last_mut(&mut self) -> Option<&mut Self::Output>
fn last_mut(&mut self) -> Option<&mut Self::Output>
Get a mutable reference to the last element in the array.
sourcefn set(&mut self, index: usize, value: Self::Output) -> Option<Self::Output> where
Self::Output: Sized,
fn set(&mut self, index: usize, value: Self::Output) -> Option<Self::Output> where
Self::Output: Sized,
Set the value of the element at the given index. Read more
sourcefn swap(&mut self, index1: usize, index2: usize) where
Self::Output: Sized,
fn swap(&mut self, index1: usize, index2: usize) where
Self::Output: Sized,
Swap the elements at two indexes.
sourcefn map_pair<F, A>(&mut self, index1: usize, index2: usize, f: F) -> A where
F: FnMut(&mut Self::Output, &mut Self::Output) -> A,
fn map_pair<F, A>(&mut self, index1: usize, index2: usize, f: F) -> A where
F: FnMut(&mut Self::Output, &mut Self::Output) -> A,
Get mutable references to the elements at two indexes and call a function on them. Read more
sourcefn sort_unstable(&mut self) where
Self::Output: Ord,
Self::Output: Sized,
fn sort_unstable(&mut self) where
Self::Output: Ord,
Self::Output: Sized,
Sort the elements of the array.
sourceimpl<A: Clone, const N: usize> Clone for RingBuffer<A, N>
impl<A: Clone, const N: usize> Clone for RingBuffer<A, N>
sourceimpl<A: Debug, const N: usize> Debug for RingBuffer<A, N>
impl<A: Debug, const N: usize> Debug for RingBuffer<A, N>
sourceimpl<A, const N: usize> Default for RingBuffer<A, N>
impl<A, const N: usize> Default for RingBuffer<A, N>
sourceimpl<A, const N: usize> Drop for RingBuffer<A, N>
impl<A, const N: usize> Drop for RingBuffer<A, N>
sourceimpl<'a, A: Clone + 'a, const N: usize> Extend<&'a A> for RingBuffer<A, N>
impl<'a, A: Clone + 'a, const N: usize> Extend<&'a A> for RingBuffer<A, N>
sourcefn extend<I: IntoIterator<Item = &'a A>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = &'a A>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<A, const N: usize> Extend<A> for RingBuffer<A, N>
impl<A, const N: usize> Extend<A> for RingBuffer<A, N>
sourcefn extend<I: IntoIterator<Item = A>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = A>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
sourceimpl<'a, A: 'a, const N: usize> From<&'a RingBuffer<A, N>> for Slice<'a, A, N>
impl<'a, A: 'a, const N: usize> From<&'a RingBuffer<A, N>> for Slice<'a, A, N>
sourcefn from(buffer: &'a RingBuffer<A, N>) -> Self
fn from(buffer: &'a RingBuffer<A, N>) -> Self
Converts to this type from the input type.
sourceimpl<'a, A: 'a, const N: usize> From<&'a mut RingBuffer<A, N>> for SliceMut<'a, A, N>
impl<'a, A: 'a, const N: usize> From<&'a mut RingBuffer<A, N>> for SliceMut<'a, A, N>
sourcefn from(buffer: &'a mut RingBuffer<A, N>) -> Self
fn from(buffer: &'a mut RingBuffer<A, N>) -> Self
Converts to this type from the input type.
sourceimpl<A, const N: usize> FromIterator<A> for RingBuffer<A, N>
impl<A, const N: usize> FromIterator<A> for RingBuffer<A, N>
sourcefn from_iter<I: IntoIterator<Item = A>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = A>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl<A, const N: usize> HasLength for RingBuffer<A, N>
impl<A, const N: usize> HasLength for RingBuffer<A, N>
sourceimpl<A: Hash, const N: usize> Hash for RingBuffer<A, N>
impl<A: Hash, const N: usize> Hash for RingBuffer<A, N>
sourceimpl<A, const N: usize> Index<usize> for RingBuffer<A, N>
impl<A, const N: usize> Index<usize> for RingBuffer<A, N>
sourceimpl<A, const N: usize> IndexMut<usize> for RingBuffer<A, N>
impl<A, const N: usize> IndexMut<usize> for RingBuffer<A, N>
sourceimpl<A, const N: usize> IntoIterator for RingBuffer<A, N>
impl<A, const N: usize> IntoIterator for RingBuffer<A, N>
sourceimpl<'a, A, const N: usize> IntoIterator for &'a RingBuffer<A, N>
impl<'a, A, const N: usize> IntoIterator for &'a RingBuffer<A, N>
sourceimpl<'a, A, const N: usize> IntoIterator for &'a mut RingBuffer<A, N>
impl<'a, A, const N: usize> IntoIterator for &'a mut RingBuffer<A, N>
sourceimpl<A: Ord, const N: usize> Ord for RingBuffer<A, N>
impl<A: Ord, const N: usize> Ord for RingBuffer<A, N>
sourceimpl<A, PrimSlice, const N: usize> PartialEq<PrimSlice> for RingBuffer<A, N> where
PrimSlice: Borrow<[A]>,
A: PartialEq,
impl<A, PrimSlice, const N: usize> PartialEq<PrimSlice> for RingBuffer<A, N> where
PrimSlice: Borrow<[A]>,
A: PartialEq,
sourceimpl<'a, A: PartialEq + 'a, const N: usize> PartialEq<RingBuffer<A, N>> for SliceMut<'a, A, N>
impl<'a, A: PartialEq + 'a, const N: usize> PartialEq<RingBuffer<A, N>> for SliceMut<'a, A, N>
sourceimpl<A: PartialEq, const N: usize> PartialEq<RingBuffer<A, N>> for RingBuffer<A, N>
impl<A: PartialEq, const N: usize> PartialEq<RingBuffer<A, N>> for RingBuffer<A, N>
sourceimpl<A, const N: usize> PartialEq<SliceMut<'_, A, N>> for RingBuffer<A, N> where
A: PartialEq,
impl<A, const N: usize> PartialEq<SliceMut<'_, A, N>> for RingBuffer<A, N> where
A: PartialEq,
sourceimpl<A: PartialOrd, const N: usize> PartialOrd<RingBuffer<A, N>> for RingBuffer<A, N>
impl<A: PartialOrd, const N: usize> PartialOrd<RingBuffer<A, N>> for RingBuffer<A, N>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
sourceimpl<A, const N: usize> PoolClone for RingBuffer<A, N> where
A: Clone,
impl<A, const N: usize> PoolClone for RingBuffer<A, N> where
A: Clone,
sourceunsafe fn clone_uninit(&self, target: &mut MaybeUninit<Self>)
unsafe fn clone_uninit(&self, target: &mut MaybeUninit<Self>)
Clone an instance of Self
into an uninitialised instance of Self
. Read more
sourceimpl<A, const N: usize> PoolDefault for RingBuffer<A, N>
impl<A, const N: usize> PoolDefault for RingBuffer<A, N>
sourceunsafe fn default_uninit(target: &mut MaybeUninit<Self>)
unsafe fn default_uninit(target: &mut MaybeUninit<Self>)
Initialise an instance of Self
to its default state. Read more
sourceimpl<const N: usize> Read for RingBuffer<u8, N>
impl<const N: usize> Read for RingBuffer<u8, N>
sourcefn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
1.36.0 · sourcefn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
Like read
, except that it reads into a slice of buffers. Read more
sourcefn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)Determines if this Read
er has an efficient read_vectored
implementation. Read more
1.0.0 · sourcefn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
Read all bytes until EOF in this source, placing them into buf
. Read more
1.0.0 · sourcefn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
Read all bytes until EOF in this source, appending them to buf
. Read more
1.6.0 · sourcefn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
Read the exact number of bytes required to fill buf
. Read more
sourcefn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
read_buf
)Pull some bytes from this source into the specified buffer. Read more
sourcefn read_buf_exact(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
read_buf
)Read the exact number of bytes required to fill buf
. Read more
1.0.0 · sourcefn by_ref(&mut self) -> &mut Self
fn by_ref(&mut self) -> &mut Self
Creates a “by reference” adaptor for this instance of Read
. Read more
sourceimpl<const N: usize> Write for RingBuffer<u8, N>
impl<const N: usize> Write for RingBuffer<u8, N>
sourcefn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. Read more
sourcefn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
sourcefn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)Determines if this Write
r has an efficient write_vectored
implementation. Read more
1.0.0 · sourcefn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
sourcefn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
impl<A: Eq, const N: usize> Eq for RingBuffer<A, N>
Auto Trait Implementations
impl<A, const N: usize> RefUnwindSafe for RingBuffer<A, N> where
A: RefUnwindSafe,
impl<A, const N: usize> Send for RingBuffer<A, N> where
A: Send,
impl<A, const N: usize> Sync for RingBuffer<A, N> where
A: Sync,
impl<A, const N: usize> Unpin for RingBuffer<A, N> where
A: Unpin,
impl<A, const N: usize> UnwindSafe for RingBuffer<A, N> where
A: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more