Compare by reference.
Compare by reference. Reuse if both values are the same instance.
Compare by reference and if different, compare using universal equality (Scala's == operator).
Compare using universal equality (Scala's == operator).
Generate an instance for a case class by comparing each case field except those specified.
Generate an instance for a case class by comparing each case field except those specified.
Example:
case class Picture(id: Long, url: String, title: String)
implicit val picReuse = Reusability.caseClassExcept[Picture]('url, 'title)
The case class type.
Same as caseClassExcept except the code generated by the macro is printed to stdout.
Generate an instance for A.
Generate an instance for A.
If A is a sealed trait or sealed abstract class, Reusability is determined by sub-class reusability (which will be derived when it doesn't exist).
If A is a case class, Reusability is determined by each field's Reusability.
Same as derive except the code generated by the macro is printed to stdout.
This is not implicit because the point of Reusability is to be fast, where as full comparison of all keys and values in a map, is usually not desirable; in some cases it will probably even be faster just rerender and have React determine that nothing has changed.
This is not implicit because the point of Reusability is to be fast, where as full comparison of all keys and values in a map, is usually not desirable; in some cases it will probably even be faster just rerender and have React determine that nothing has changed.
Nonetheless, there are cases where a full comparison is desired and so use this as needed. Reusability[K]
isn't
needed because its existence in the map (and thus universal equality) is all that's necessary.
Time is O(|m₁|+|m₂|).
Declare a type reusable when both values fail a given predicate.
Declare a type reusable when both values pass a given predicate.