[][src]Crate is_same

This crate provides the IsSame trait, which is specifically for diffing immutable data that has been transformed. The trait differs from PartialEq in some important ways:

  • Floating point values are compared by their bit patterns, preventing NaN values from making a data structure permanently compare as not equal to itself. This also lets you detect a value changing from -0.0 to 0.0.
  • Referential equality is used to make comparisons more efficient. The library assumes that the contents of Rc<T> and Arc<T> are immutable and can't change, so they only need to be compared by their pointers.

There is also a is-same-derive crate which can automatically derive an IsSame implementation for your structs:

use is_same_derive::IsSame;

struct MyStruct {
    count: usize,
    ch: char,
    text: String,



Compares two versions of a piece of data to see if it has changed.