pub struct ExaIter<I, T> { /* private fields */ }Expand description
Adapter allowing any iterator of encodable values to be treated and passed as a one dimensional
parameter array for a column to Exasol in a single query invocation. Multi dimensional arrays
are not supported. The adapter is needed because Encode is still a foreign trait and thus
cannot be implemented in a generic manner to all types implementing IntoIterator.
Custom types can be used with the ExaIter adapter by implementing the ExaHasArrayType
marker trait.
Note that the Encode trait requires the ability to encode by reference, thus the adapter
takes a type that implements IntoIterator. But since iteration requires mutability,
the adaptar also requires Clone. The adapter definition should steer it towards being used
with cheaply clonable iterators since it expects the iteration elements to be references.
However, care should still be taken so as not to clone expensive IntoIterator types.
use sqlx_exasol::types::ExaIter;
let vector = vec![1, 2, 3];
let borrowed_iter = ExaIter::new(vector.iter().filter(|v| **v % 2 == 0));Implementations§
Trait Implementations§
Source§impl<I, T> Encode<'_, Exasol> for ExaIter<I, T>
impl<I, T> Encode<'_, Exasol> for ExaIter<I, T>
Source§fn encode_by_ref(&self, buf: &mut ExaBuffer) -> Result<IsNull, BoxDynError>
fn encode_by_ref(&self, buf: &mut ExaBuffer) -> Result<IsNull, BoxDynError>
fn size_hint(&self) -> usize
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
Auto Trait Implementations§
impl<I, T> Freeze for ExaIter<I, T>where
I: Freeze,
impl<I, T> RefUnwindSafe for ExaIter<I, T>where
I: RefUnwindSafe,
impl<I, T> Send for ExaIter<I, T>where
I: Send,
impl<I, T> Sync for ExaIter<I, T>where
I: Sync,
impl<I, T> Unpin for ExaIter<I, T>where
I: Unpin,
impl<I, T> UnwindSafe for ExaIter<I, T>where
I: 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more