pub struct Tuple { /* private fields */ }
Expand description
Tuple with named values
Names are optional, which means Identifiers can be empty.
Implementations§
Source§impl Tuple
impl Tuple
Sourcepub fn new_named(named: HashMap<Identifier, Value>, src_ref: SrcRef) -> Self
pub fn new_named(named: HashMap<Identifier, Value>, src_ref: SrcRef) -> Self
Create new named tuple.
Sourcepub fn insert(&mut self, id: Identifier, value: Value)
pub fn insert(&mut self, id: Identifier, value: Value)
Insert new (or overwrite existing) value into tuple
Sourcepub fn named_iter(&self) -> Iter<'_, Identifier, Value>
pub fn named_iter(&self) -> Iter<'_, Identifier, Value>
Return an iterator over all named values
Sourcepub fn tuple_type(&self) -> TupleType
pub fn tuple_type(&self) -> TupleType
Return the tuple type.
Sourcepub fn combine(
self,
rhs: Tuple,
op: impl Fn(Value, Value) -> Result<Value, ValueError>,
) -> Result<Self, ValueError>
pub fn combine( self, rhs: Tuple, op: impl Fn(Value, Value) -> Result<Value, ValueError>, ) -> Result<Self, ValueError>
Combine two tuples of the same type with an operation.
This function is used for +
and -
builtin operators.
Sourcepub fn apply(
self,
value: Value,
op: impl Fn(Value, Value) -> Result<Value, ValueError>,
) -> Result<Self, ValueError>
pub fn apply( self, value: Value, op: impl Fn(Value, Value) -> Result<Value, ValueError>, ) -> Result<Self, ValueError>
Apply value with an operation to a tuple.
This function is used for *
and /
builtin operators.
Sourcepub fn transform(
self,
op: impl Fn(Value) -> Result<Value, ValueError>,
) -> Result<Self, ValueError>
pub fn transform( self, op: impl Fn(Value) -> Result<Value, ValueError>, ) -> Result<Self, ValueError>
Transform each value in the tuple.
Sourcepub fn ray(&mut self)
pub fn ray(&mut self)
Dissolve unnamed them.
Transparent tuples are unnamed tuple items of a tuple.
assert_eq!( (x=0, (y=0, z=0)), (x=0, y=0, z=0) );
/// ^ unnamed tuple
Sourcepub fn multiplicity<P: FnMut(Tuple)>(&self, ids: IdentifierList, p: P)
pub fn multiplicity<P: FnMut(Tuple)>(&self, ids: IdentifierList, p: P)
Call a predicate for each tuple multiplicity.
ids
: Items to multiply.p
: Predicate to call for each resulting tuple.
§Example
Input | Predicate’s Parameters |
---|---|
([x₀, x₁], y) | (x₀, y) , (x₁, y) |
Trait Implementations§
Source§impl FromIterator<(Identifier, Value)> for Tuple
impl FromIterator<(Identifier, Value)> for Tuple
Source§fn from_iter<T: IntoIterator<Item = (Identifier, Value)>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = (Identifier, Value)>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl FromIterator<Tuple> for Tuple
impl FromIterator<Tuple> for Tuple
Source§impl IntoIterator for Tuple
impl IntoIterator for Tuple
Source§impl SrcReferrer for Tuple
impl SrcReferrer for Tuple
Source§impl ValueAccess for Tuple
impl ValueAccess for Tuple
Source§fn by_str<'a, T>(&'a self, id: &str) -> Result<T, ValueError>
fn by_str<'a, T>(&'a self, id: &str) -> Result<T, ValueError>
Helper function to fetch an argument by string.
Source§fn get_value(&self, id: &str) -> Result<&Value, ValueError>
fn get_value(&self, id: &str) -> Result<&Value, ValueError>
Fetch an argument value by name as
&str
. Read moreSource§fn contains_id(&self, id: &Identifier) -> bool
fn contains_id(&self, id: &Identifier) -> bool
Return
true
, if tuple contains a value with that nameimpl StructuralPartialEq for Tuple
Auto Trait Implementations§
impl Freeze for Tuple
impl !RefUnwindSafe for Tuple
impl !Send for Tuple
impl !Sync for Tuple
impl Unpin for Tuple
impl !UnwindSafe for Tuple
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§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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string()
Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString
. Read more