/// Perform a deep value comparison of two variants.
Perform a deep value comparison of two variants.
Perform a deep value comparison of two variants .
pub(crate) fn value_ptr_eq(vm: &mut Vm, a: &Self, b: &Self) -> Result<bool, VmError> {
        debug_assert_eq!(
            a.rtti.enum_hash, b.rtti.enum_hash,
            "comparison only makes sense if enum hashes match"
        );
        if a.rtti.hash != b.rtti.hash {
            return Ok(false);
        }
        Ok(match (&a.data, &b.data) {
            (VariantData::Unit, VariantData::Unit) => true,
            (VariantData::Tuple(a), VariantData::Tuple(b)) => return Tuple::value_ptr_eq(vm, a, b),
            (VariantData::Struct(a), VariantData::Struct(b)) => {
                return Object::value_ptr_eq(vm, a, b)
            }
            _ => false,
        })
    }
pub ( crate ) fn value_ptr_eq ( vm : & mut Vm , a : & Self , b : & Self ) -> Result < bool , VmError > { debug_assert_eq ! ( a rtti enum_hash b rtti enum_hash " " ) ; if a . rtti . hash != b . rtti . hash { return Ok ( false ) ; } Ok ( match ( & a . data , & b . data ) { ( VariantData :: Unit , VariantData :: Unit ) => true , ( VariantData :: Tuple ( a ) , VariantData :: Tuple ( b ) ) => return Tuple :: value_ptr_eq ( vm , a , b ) , ( VariantData :: Struct ( a ) , VariantData :: Struct ( b ) ) => { return Object :: value_ptr_eq ( vm , a , b ) } _ => false , } ) }
Perform a deep value comparison of two variants.
Perform a deep value comparison of two variants .
vm
&mut Vm
a
&Self
b
&Self