reference_equals
function · ferroui-controls · v0.5.0
fn reference_equals(a: &Option<ferroui_base::BoxedValue>, b: &Option<ferroui_base::BoxedValue>) -> bool
Whether two untyped values are the same object: C# ReferenceEquals (and
== / != on object) for values that travel in boxes.
The rule:
- both null, or the same box: the same reference;
- boxes that hold handles of the same object of the class hierarchy (a
control boxed twice, or boxed once as
Ref<Control>and once asRef<Border>): the same reference; - boxes that both hold a string: the same reference if the strings are equal. A string is the immutable value-like type that the lists of the managed original hand out as the same instance on every read, whereas a typed list of strings here boxes each string anew on every read; without this, an unchanged item read twice would look like another object;
- anything else in two boxes (two separately boxed equal numbers, two equal structures) is two references, as two boxings are in the managed original.
Use items_equal where the original calls Equals.
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.