Trait schema_analysis::traits::Coalesce
source · Expand description
This trait defines a way to merge two instances of the same type.
let mut context_1: BooleanContext = Default::default();
context_1.aggregate(&true);
context_1.aggregate(&true);
let mut schema_1 = Schema::Boolean(context_1);
let mut context_2: BooleanContext = Default::default();
context_2.aggregate(&false);
let mut schema_2 = Schema::Boolean(context_2);
schema_1.coalesce(schema_2); // schema_2 is gone.
let mut context_merged: BooleanContext = Default::default();
context_merged.aggregate(&true);
context_merged.aggregate(&true);
context_merged.aggregate(&false);
let schema_merged = Schema::Boolean(context_merged);
assert_eq!(schema_1, schema_merged);