-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Model BidiAuxiliaryProperties
as an EnumeratedProperty
#5597
Conversation
} | ||
fn from_unaligned(unaligned: Self::ULE) -> Self { | ||
let [a, b, c] = unaligned.0; | ||
TrieValue::try_from_u32(u32::from_le_bytes([a, b, c, 0])).unwrap_or_default() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm. a non-safety invariant of ZeroVec is that byte equality is equality, are we okay with giving that up here?
The worst that can happen is that ==
on ZeroVec
will do unexpected things with bad data, but I'm overall fine with that. Either way, I think we should document that this breaks the invariant but is convenient
cc @sffc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you think this is being given up here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unwrap_or_default()
means that two unequal byte sequences will produce equal values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right. I can write a custom ULE type?
No description provided.