pub trait VarEqBacking {
// Required method
fn eq(&self, other: &Self) -> bool;
}
Expand description
Check if ReadVar
/ WriteVar
instances are backed by the same underlying
flowey Var.
§Why not use Eq
? Why have a whole separate trait?
ReadVar
and WriteVar
are, in some sense, flowey’s analog to
“pointers”, insofar as these types primary purpose is to mediate access to
some contained value, as opposed to being “values” themselves.
Assuming you agree with this analogy, then we can apply the same logic to
ReadVar
and WriteVar
as Rust does to Box<T>
wrt. what the Eq
implementation should mean.
Namely: Eq
should check the equality of the contained objects, as
opposed to the pointers themselves.
Unfortunately, unlike Box<T>
, it is impossible to have an Eq
impl for
ReadVar
/ WriteVar
that checks contents for equality, due to the fact
that these types exist at flow resolution time, whereas the values they
contain only exist at flow runtime.
As such, we have a separate trait to perform different kinds of equality checks on Vars.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.