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
Don't have any hard feelings towards either solution, though it would be nice if attrs.fields().len() would return 3 and attrs.values().len() would return 1 IMO. Don't know if that's hard to change implementation-wise though. We intentionally don't visit Option::None and tracing::field::Empty, but hard coding these doesn't seem right.
Without changes to the Value trait or how values are put in the valueset, making len() return 1 would pretty much require visiting each one just to see if it would yield a value (essentially what I've done above). The len() implementation is already doing an O(n) walk (to ensure the callsites are the same), so it wouldn't be a dramatic change in that regard.
Bug Report
Version
Latest
tracing v0.1.40
. Tested below withtracing-subscriber v0.3.18
but that isn't particularly relevant.Description
The documentation says that
ValueSet::len
:But that is not correct. The length does not consider that
None
values (viaEmpty
orOption
) which will not be given to a visitor.Demo
I am willing to fix this whether the "fix" is to adjust the documentation or the implementation.
The text was updated successfully, but these errors were encountered: