Struct arithmetic_eval::Tuple
source · pub struct Tuple<T> { /* private fields */ }
Expand description
Tuple of zero or more values.
A tuple is similar to a Vec
with Value
elements and can be converted from / to it.
It is possible to iterate over elements, index them, etc.
§Examples
let mut tuple = Tuple::<u32>::default();
tuple.push(Value::Prim(3));
tuple.push(Value::Prim(5));
assert_eq!(tuple.len(), 2);
assert_eq!(tuple[1], Value::Prim(5));
assert!(tuple.iter().all(|val| !val.is_void()));
// `Tuple` implements `FromIterator` / `Extend`.
let mut other_tuple: Tuple<u32> = (0..=2).map(Value::Prim).collect();
other_tuple.extend(tuple);
assert_eq!(other_tuple.len(), 5);
Implementations§
Trait Implementations§
source§impl<T, V> Extend<V> for Tuple<T>
impl<T, V> Extend<V> for Tuple<T>
source§fn extend<I: IntoIterator<Item = V>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = V>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl<T, V> FromIterator<V> for Tuple<T>
impl<T, V> FromIterator<V> for Tuple<T>
source§fn from_iter<I: IntoIterator<Item = V>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = V>>(iter: I) -> Self
Creates a value from an iterator. Read more
source§impl<T> IntoEvalResult<T> for Tuple<T>
impl<T> IntoEvalResult<T> for Tuple<T>
source§fn into_eval_result(self) -> Result<Value<T>, ErrorOutput>
fn into_eval_result(self) -> Result<Value<T>, ErrorOutput>
Performs the conversion.
source§impl<'r, T> IntoIterator for &'r Tuple<T>
impl<'r, T> IntoIterator for &'r Tuple<T>
source§impl<T> IntoIterator for Tuple<T>
impl<T> IntoIterator for Tuple<T>
source§impl<T: PartialEq> PartialEq for Tuple<T>
impl<T: PartialEq> PartialEq for Tuple<T>
source§impl<T> TryFromValue<T> for Tuple<T>
impl<T> TryFromValue<T> for Tuple<T>
source§fn try_from_value(value: Value<T>) -> Result<Self, FromValueError>
fn try_from_value(value: Value<T>) -> Result<Self, FromValueError>
Attempts to convert
value
to a type supported by the function.impl<T> StructuralPartialEq for Tuple<T>
Auto Trait Implementations§
impl<T> Freeze for Tuple<T>
impl<T> !RefUnwindSafe for Tuple<T>
impl<T> !Send for Tuple<T>
impl<T> !Sync for Tuple<T>
impl<T> Unpin for Tuple<T>where
T: Unpin,
impl<T> !UnwindSafe for Tuple<T>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)