DynPartialEqDraw

Trait DynPartialEqDraw 

Source
pub trait DynPartialEqDraw: DynCloneDraw {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn dyn_eq(&self, other: &dyn DynPartialEqDraw) -> bool;
}
Expand description

A trait that allows for dynamic equality testing of trait objects.

This trait provides a workaround for the fact that PartialEq is not object-safe. It allows types that are PartialEq to be compared even when they are behind a trait object by downcasting them to their concrete types.

Required Methods§

Source

fn as_any(&self) -> &dyn Any

Returns the object as a &dyn Any.

Source

fn dyn_eq(&self, other: &dyn DynPartialEqDraw) -> bool

Performs a dynamic equality check against another DynPartialEqDraw trait object.

Implementors§