pub struct Splat<T> { /* private fields */ }Expand description
Splat argument.
This is a marker trait that is used as a wrapper around tuples of arguments allowing to invoke a function with multiple arguments as if it were a single argument. Its purpose is to make writing operators with multiple arguments more ergonomic, which is particularly useful for joins.
All function traits implement variations of Splat for tuples of up to 8
elements, which is likely to be sufficient for most use cases. Please note
that most of the time, this type is only ever needed for creating flexible
operator functions, so you’ll rarely want to use it directly. Additionally,
note that Splat itself doesn’t impose any trait bounds in order to not
require even more trait bounds in the signature of implementors. Moreover,
it doesn’t implement Value, meaning it can only be used temporarily
inside operators, but never returned.
§Examples
use zrx_stream::function::Splat;
// Create splat from tuple
let splat = Splat::from((1, 2));Implementations§
Source§impl<T> Splat<T>
impl<T> Splat<T>
Sourcepub fn inner(&self) -> &T
pub fn inner(&self) -> &T
Returns the inner tuple of arguments.
§Examples
use zrx_stream::function::Splat;
// Create splat from tuple
let splat = Splat::from((1, 2));
assert_eq!(splat.inner(), &(1, 2));Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Returns the inner tuple of arguments, consuming the splat.
§Examples
use zrx_stream::function::Splat;
// Create splat from tuple
let splat = Splat::from((1, 2));
assert_eq!(splat.into_inner(), (1, 2));Source§impl<T> Splat<T>
impl<T> Splat<T>
Sourcepub fn from_ref(inner: &T) -> &Self
pub fn from_ref(inner: &T) -> &Self
Creates a splat argument from a reference to a tuple.
This method converts &T to &Splat<T>, which allows us to use splat
arguments in any function that takes a reference to a value T without
cloning the value. While the conversion mandates the use of unsafe,
it’s safe due to identical memory layout guarantees.
§Examples
use zrx_stream::function::Splat;
// Create splat from tuple reference
let splat = Splat::from_ref(&(1, 2));Trait Implementations§
Source§impl<F, I, T1, T2, T3> FilterFn<I, Splat<(T1, T2, T3)>> for F
impl<F, I, T1, T2, T3> FilterFn<I, Splat<(T1, T2, T3)>> for F
Source§impl<F, I, T1, T2, T3, T4> FilterFn<I, Splat<(T1, T2, T3, T4)>> for F
impl<F, I, T1, T2, T3, T4> FilterFn<I, Splat<(T1, T2, T3, T4)>> for F
Source§impl<F, I, T1, T2, T3, T4, T5> FilterFn<I, Splat<(T1, T2, T3, T4, T5)>> for F
impl<F, I, T1, T2, T3, T4, T5> FilterFn<I, Splat<(T1, T2, T3, T4, T5)>> for F
Source§impl<F, I, T1, T2, T3, T4, T5, T6> FilterFn<I, Splat<(T1, T2, T3, T4, T5, T6)>> for F
impl<F, I, T1, T2, T3, T4, T5, T6> FilterFn<I, Splat<(T1, T2, T3, T4, T5, T6)>> for F
Source§impl<F, I, T1, T2, T3, T4, T5, T6, T7> FilterFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7)>> for F
impl<F, I, T1, T2, T3, T4, T5, T6, T7> FilterFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7)>> for F
Source§impl<F, I, T1, T2, T3, T4, T5, T6, T7, T8> FilterFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7, T8)>> for F
impl<F, I, T1, T2, T3, T4, T5, T6, T7, T8> FilterFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7, T8)>> for F
Source§impl<F, I, T1, U> FilterMapFn<I, Splat<(T1,)>, U> for F
impl<F, I, T1, U> FilterMapFn<I, Splat<(T1,)>, U> for F
Source§impl<F, I, T1, T2, U> FilterMapFn<I, Splat<(T1, T2)>, U> for F
impl<F, I, T1, T2, U> FilterMapFn<I, Splat<(T1, T2)>, U> for F
Source§impl<F, I, T1, T2, T3, U> FilterMapFn<I, Splat<(T1, T2, T3)>, U> for F
impl<F, I, T1, T2, T3, U> FilterMapFn<I, Splat<(T1, T2, T3)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, U> FilterMapFn<I, Splat<(T1, T2, T3, T4)>, U> for F
impl<F, I, T1, T2, T3, T4, U> FilterMapFn<I, Splat<(T1, T2, T3, T4)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, T5, U> FilterMapFn<I, Splat<(T1, T2, T3, T4, T5)>, U> for F
impl<F, I, T1, T2, T3, T4, T5, U> FilterMapFn<I, Splat<(T1, T2, T3, T4, T5)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, T5, T6, U> FilterMapFn<I, Splat<(T1, T2, T3, T4, T5, T6)>, U> for F
impl<F, I, T1, T2, T3, T4, T5, T6, U> FilterMapFn<I, Splat<(T1, T2, T3, T4, T5, T6)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, T5, T6, T7, U> FilterMapFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7)>, U> for F
impl<F, I, T1, T2, T3, T4, T5, T6, T7, U> FilterMapFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, T5, T6, T7, T8, U> FilterMapFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7, T8)>, U> for F
impl<F, I, T1, T2, T3, T4, T5, T6, T7, T8, U> FilterMapFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7, T8)>, U> for F
Source§impl<F, I, T1, T2, T3, U> InspectFn<I, Splat<(T1, T2, T3)>, U> for F
impl<F, I, T1, T2, T3, U> InspectFn<I, Splat<(T1, T2, T3)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, U> InspectFn<I, Splat<(T1, T2, T3, T4)>, U> for F
impl<F, I, T1, T2, T3, T4, U> InspectFn<I, Splat<(T1, T2, T3, T4)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, T5, U> InspectFn<I, Splat<(T1, T2, T3, T4, T5)>, U> for F
impl<F, I, T1, T2, T3, T4, T5, U> InspectFn<I, Splat<(T1, T2, T3, T4, T5)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, T5, T6, U> InspectFn<I, Splat<(T1, T2, T3, T4, T5, T6)>, U> for F
impl<F, I, T1, T2, T3, T4, T5, T6, U> InspectFn<I, Splat<(T1, T2, T3, T4, T5, T6)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, T5, T6, T7, U> InspectFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7)>, U> for F
impl<F, I, T1, T2, T3, T4, T5, T6, T7, U> InspectFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, T5, T6, T7, T8, U> InspectFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7, T8)>, U> for F
impl<F, I, T1, T2, T3, T4, T5, T6, T7, T8, U> InspectFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7, T8)>, U> for F
Source§impl<F, I, T1, T2, T3, U> MapFn<I, Splat<(T1, T2, T3)>, U> for F
impl<F, I, T1, T2, T3, U> MapFn<I, Splat<(T1, T2, T3)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, U> MapFn<I, Splat<(T1, T2, T3, T4)>, U> for F
impl<F, I, T1, T2, T3, T4, U> MapFn<I, Splat<(T1, T2, T3, T4)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, T5, U> MapFn<I, Splat<(T1, T2, T3, T4, T5)>, U> for F
impl<F, I, T1, T2, T3, T4, T5, U> MapFn<I, Splat<(T1, T2, T3, T4, T5)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, T5, T6, U> MapFn<I, Splat<(T1, T2, T3, T4, T5, T6)>, U> for F
impl<F, I, T1, T2, T3, T4, T5, T6, U> MapFn<I, Splat<(T1, T2, T3, T4, T5, T6)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, T5, T6, T7, U> MapFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7)>, U> for F
impl<F, I, T1, T2, T3, T4, T5, T6, T7, U> MapFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7)>, U> for F
Source§impl<F, I, T1, T2, T3, T4, T5, T6, T7, T8, U> MapFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7, T8)>, U> for F
impl<F, I, T1, T2, T3, T4, T5, T6, T7, T8, U> MapFn<I, Splat<(T1, T2, T3, T4, T5, T6, T7, T8)>, U> for F
Source§impl<T: Ord> Ord for Splat<T>
impl<T: Ord> Ord for Splat<T>
Source§impl<T: PartialOrd> PartialOrd for Splat<T>
impl<T: PartialOrd> PartialOrd for Splat<T>
impl<T: Eq> Eq for Splat<T>
impl<T> StructuralPartialEq for Splat<T>
Auto Trait Implementations§
impl<T> Freeze for Splat<T>where
T: Freeze,
impl<T> RefUnwindSafe for Splat<T>where
T: RefUnwindSafe,
impl<T> Send for Splat<T>where
T: Send,
impl<T> Sync for Splat<T>where
T: Sync,
impl<T> Unpin for Splat<T>where
T: Unpin,
impl<T> UnsafeUnpin for Splat<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Splat<T>where
T: 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<K, V> TryAsStorage<K> for V
impl<K, V> TryAsStorage<K> for V
Source§fn try_as_storage(
item: &(dyn Any + 'static),
) -> Result<<V as TryAsStorage<K>>::Target<'_>, Error>
fn try_as_storage( item: &(dyn Any + 'static), ) -> Result<<V as TryAsStorage<K>>::Target<'_>, Error>
Attempts to convert into a storage reference.
§Errors
The following errors might be returned:
Error::Downcast: Item cannot be downcast.
§Examples
use std::any::Any;
use zrx_storage::convert::TryAsStorage;
use zrx_storage::Storage;
// Create storage and initial state
let mut storage = Storage::default();
storage.insert("key", 42);
// Obtain type-erased reference
let item: &dyn Any = &storage;
// Obtain storage reference
let storage = <i32>::try_as_storage(item)?;Source§impl<K, V> TryAsStorageMut<K> for V
impl<K, V> TryAsStorageMut<K> for V
Source§fn try_as_storage_mut(
item: &mut (dyn Any + 'static),
) -> Result<<V as TryAsStorageMut<K>>::Target<'_>, Error>
fn try_as_storage_mut( item: &mut (dyn Any + 'static), ) -> Result<<V as TryAsStorageMut<K>>::Target<'_>, Error>
Attempts to convert into a mutable storage reference.
§Errors
The following errors might be returned:
Error::Downcast: Item cannot be downcast.
§Examples
use std::any::Any;
use zrx_storage::convert::TryAsStorageMut;
use zrx_storage::Storage;
// Create storage and initial state
let mut storage = Storage::default();
storage.insert("key", 42);
// Obtain mutable type-erased reference
let item: &mut dyn Any = &mut storage;
// Obtain mutable storage reference
let storage = <i32>::try_as_storage_mut(item)?;