pub struct BatchValuesFromIterator<'sr, IT> { /* private fields */ }
Expand description
Implements BatchValues
from an Iterator
over references to things that implement SerializeRow
This is to avoid requiring allocating a new Vec
containing all the SerializeRow
s directly:
with this, one can write:
session.batch(&batch, BatchValuesFromIter::from(lines_to_insert.iter().map(|l| &l.value_list)))
where lines_to_insert
may also contain e.g. data to pick the statement…
The underlying iterator will always be cloned at least once, once to compute the length if it can’t be known
in advance, and be re-cloned at every retry.
It is consequently expected that the provided iterator is cheap to clone (e.g. slice.iter().map(...)
).
Implementations§
Source§impl<'sr, IT, SR> BatchValuesFromIterator<'sr, IT>
impl<'sr, IT, SR> BatchValuesFromIterator<'sr, IT>
Sourcepub fn new(into_iter: impl IntoIterator<IntoIter = IT>) -> Self
pub fn new(into_iter: impl IntoIterator<IntoIter = IT>) -> Self
Creates a new `BatchValuesFromIter`` object.
Trait Implementations§
Source§impl<'sr, IT, SR> BatchValues for BatchValuesFromIterator<'sr, IT>
impl<'sr, IT, SR> BatchValues for BatchValuesFromIterator<'sr, IT>
Source§type BatchValuesIter<'r> = BatchValuesIteratorFromIterator<IT>
where
Self: 'r
type BatchValuesIter<'r> = BatchValuesIteratorFromIterator<IT> where Self: 'r
An
Iterator
-like object over the values from the parent BatchValues
object.Source§fn batch_values_iter(&self) -> Self::BatchValuesIter<'_>
fn batch_values_iter(&self) -> Self::BatchValuesIter<'_>
Returns an iterator over the data contained in this object.
Auto Trait Implementations§
impl<'sr, IT> Freeze for BatchValuesFromIterator<'sr, IT>where
IT: Freeze,
impl<'sr, IT> RefUnwindSafe for BatchValuesFromIterator<'sr, IT>where
IT: RefUnwindSafe,
impl<'sr, IT> Send for BatchValuesFromIterator<'sr, IT>where
IT: Send,
impl<'sr, IT> Sync for BatchValuesFromIterator<'sr, IT>where
IT: Sync,
impl<'sr, IT> Unpin for BatchValuesFromIterator<'sr, IT>where
IT: Unpin,
impl<'sr, IT> UnwindSafe for BatchValuesFromIterator<'sr, IT>where
IT: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more