pub struct Aggregate(pub Index);
Expand description
A collection of Type
s.
XXX I’ve added Array as using Aggregate in the hope ExtractValue could be used just like with struct aggregates, but it turns out we need ExtractElement (which takes an index Value). So Aggregate can be a ‘struct’ or ‘array’ but you only ever use them with Struct and Array types and with ExtractValue and ExtractElement… so they’re orthogonal and we can simplify aggregate again to be only for structs.
But also to keep Type as Copy we need to put the Array meta into another copy type (rather than
recursing with Box
NOTE: Aggregate
derives Eq
(and PartialEq
) so that it can also derive Hash
. But we must
be careful not to use ==
or !=
to compare Aggregate
for equivalency – i.e., to check
that they represent the same collection of types. Instead the is_equivalent()
method is
provided. XXX Perhaps Hash
should be impl’d directly without Eq
if possible?
Tuple Fields
0: Index
Implementations
sourceimpl Aggregate
impl Aggregate
sourcepub fn new_struct(context: &mut Context, field_types: Vec<Type>) -> Self
pub fn new_struct(context: &mut Context, field_types: Vec<Type>) -> Self
Return a new struct specific aggregate.
sourcepub fn new_array(context: &mut Context, element_type: Type, count: u64) -> Self
pub fn new_array(context: &mut Context, element_type: Type, count: u64) -> Self
Returna new array specific aggregate.
sourcepub fn is_equivalent(&self, context: &Context, other: &Aggregate) -> bool
pub fn is_equivalent(&self, context: &Context, other: &Aggregate) -> bool
Tests whether an aggregate has the same sub-types.
sourcepub fn get_field_type(&self, context: &Context, indices: &[u64]) -> Option<Type>
pub fn get_field_type(&self, context: &Context, indices: &[u64]) -> Option<Type>
Get the type of (nested) aggregate fields, if found. If an index is into a Union
then it
will get the type of the indexed variant.
sourcepub fn get_elem_type(&self, context: &Context) -> Option<Type>
pub fn get_elem_type(&self, context: &Context) -> Option<Type>
Get the type of the array element, if applicable.
Trait Implementations
sourceimpl PartialEq<Aggregate> for Aggregate
impl PartialEq<Aggregate> for Aggregate
impl Copy for Aggregate
impl Eq for Aggregate
impl StructuralEq for Aggregate
impl StructuralPartialEq for Aggregate
Auto Trait Implementations
impl RefUnwindSafe for Aggregate
impl Send for Aggregate
impl Sync for Aggregate
impl Unpin for Aggregate
impl UnwindSafe for Aggregate
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more