[−][src]Trait alloc_wg::iter::TryExtend
Extend a collection "fallibly" with the contents of an iterator.
Associated Types
type Err
Required methods
fn try_extend<T: IntoIterator<Item = A>>(
&mut self,
iter: T
) -> Result<(), Self::Err>
&mut self,
iter: T
) -> Result<(), Self::Err>
Extends a collection "fallibly" with the contents of an iterator.
Examples
Basic usage:
use alloc_wg::{iter::TryExtend, vec}; // You can extend a Vec<char> with some chars: let mut message = vec!['a', 'b', 'c']; message.try_extend(['d', 'e', 'f'].iter())?; assert_eq!(vec!['a', 'b', 'c', 'd', 'e', 'f'], message);
Implementors
impl<'a, A: AllocRef> TryExtend<&'a char> for String<A>
[src]
type Err = TryReserveError
fn try_extend<I: IntoIterator<Item = &'a char>>(
&mut self,
iter: I
) -> Result<(), Self::Err>
[src]
&mut self,
iter: I
) -> Result<(), Self::Err>
impl<'a, A: AllocRef> TryExtend<&'a str> for String<A>
[src]
type Err = TryReserveError
fn try_extend<I: IntoIterator<Item = &'a str>>(
&mut self,
iter: I
) -> Result<(), Self::Err>
[src]
&mut self,
iter: I
) -> Result<(), Self::Err>
impl<'a, A: AllocRef> TryExtend<Cow<'a, str>> for String<A>
[src]
type Err = TryReserveError
fn try_extend<I: IntoIterator<Item = Cow<'a, str>>>(
&mut self,
iter: I
) -> Result<(), Self::Err>
[src]
&mut self,
iter: I
) -> Result<(), Self::Err>
impl<'a, T: 'a + Copy, A> TryExtend<&'a T> for Vec<T, A> where
A: AllocRef,
[src]
A: AllocRef,
type Err = TryReserveError
fn try_extend<I: IntoIterator<Item = &'a T>>(
&mut self,
iter: I
) -> Result<(), Self::Err>
[src]
&mut self,
iter: I
) -> Result<(), Self::Err>
impl<A: AllocRef> TryExtend<char> for String<A>
[src]
type Err = TryReserveError
fn try_extend<I: IntoIterator<Item = char>>(
&mut self,
iter: I
) -> Result<(), Self::Err>
[src]
&mut self,
iter: I
) -> Result<(), Self::Err>
impl<A: AllocRef, B: AllocRef> TryExtend<String<B>> for String<A>
[src]
type Err = TryReserveError
fn try_extend<I: IntoIterator<Item = String<B>>>(
&mut self,
iter: I
) -> Result<(), Self::Err>
[src]
&mut self,
iter: I
) -> Result<(), Self::Err>
impl<T, A: AllocRef> TryExtend<T> for Vec<T, A>
[src]
type Err = TryReserveError
fn try_extend<I: IntoIterator<Item = T>>(
&mut self,
iter: I
) -> Result<(), Self::Err>
[src]
&mut self,
iter: I
) -> Result<(), Self::Err>