Closed acdupont closed 1 year ago
This change is a bit awkward with the existing UseProperties
because a stable_hash_propertynames
can handle all use cases. An alternate implementation could be to add a ignore
field to the UseProperties
.
I think this is already possible by using transform
(but note that the API for this may be changing a bit if #22 merges).
For example
struct MyType
x::Int
y::Int
__priviate::String
end
StableHashTraits.transform(x::MyType) = (; x.x, x.y)
This would exclude the __private
field from hashing.
If #22 merges, this would like like the following:
struct MyType
x::Int
y::Int
__priviate::String
end
StableHashTraits.has_method(::MyType) = UseTransform(x -> (; x.x, x.y))
I ended up using transform
as well. Since tranform
is more general and covers the use case of this PR, I'm closing it.
Add ability for users to specify list of properties to be used when
UseProperties
.