You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would be nice if a comparison function could be passed. And also be able to ignore the order of things.
In my program i read in json ["hello", "world"] and ["world", "hello"] this will be picked up as two changes, but i don't really care for the order in the array. Would be nice to be able to set per array if it needs to compare indices (the default) or not.
Another thing is that instead of array of strings i will have an array of objects and one property of an object should be ignored during comparison. [{ignore_this:"timestamp", compare_this: "important data"}, { .. another object ..}]
I think to design this in the library will not be so easy because the passed in function probably needs knowledge of what it is looking at (some path from the root struct) + access to parents + access to children (and therefor implicit access to siblings).
I can not fix this by manipulating the data i have up front. For example sorting the data and removing that one property from an object. Consider this these two arrays (string example, not with object example): ["hello", "world"] and ["hello", "lol", "world"]. The diff is as follows:
It is a logic error for an item to be modified in such a way that the item's ordering relative to any other item, as determined by the Ord trait, changes while it is in the set.
Maybe it's possible to change the diff function to make it generic over a type so people can choose a structure that cares about order or not. I don't know if there is a candidate data structure that doesn't care about order, but i could look or ask around.
Would be nice if a comparison function could be passed. And also be able to ignore the order of things.
In my program i read in json
["hello", "world"]
and["world", "hello"]
this will be picked up as two changes, but i don't really care for the order in the array. Would be nice to be able to set per array if it needs to compare indices (the default) or not.Another thing is that instead of array of strings i will have an array of objects and one property of an object should be ignored during comparison.
[{ignore_this:"timestamp", compare_this: "important data"}, { .. another object ..}]
I think to design this in the library will not be so easy because the passed in function probably needs knowledge of what it is looking at (some path from the root struct) + access to parents + access to children (and therefor implicit access to siblings).
I can not fix this by manipulating the data i have up front. For example sorting the data and removing that one property from an object. Consider this these two arrays (string example, not with object example):
["hello", "world"]
and["hello", "lol", "world"]
. The diff is as follows:So i would need index insensitive diff and it would change to:
Maybe there are already facilities in the library that have some of the things i asked for. But i'm not sure what to look for.
The text was updated successfully, but these errors were encountered: