Skip to content
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

Add VarZeroVecFormat support to VarTuple and make_var #5808

Merged
merged 5 commits into from
Nov 13, 2024

Conversation

Manishearth
Copy link
Member

Part of holistic work in #5523

Part of #2312 (Somehow never filed a separate issue for this, but I mentioned it in a commetn)

@Manishearth Manishearth requested review from sffc and a team as code owners November 12, 2024 19:19
it's internal: "user convenience" is irrelevant and this is safer
@Manishearth Manishearth force-pushed the makevar-format branch 2 times, most recently from f978e56 to d64044e Compare November 12, 2024 20:41
assert!(!fields.is_empty(), "Must have at least one unsized field");
Self { fields }

let format_param = format_param.unwrap_or_else(|| quote!(zerovec::vecs::Index16));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought: make it a required parameter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not: I want the user-facing things (VarZeroVec, make_varule, TupleNVarULE) to default to Index16. Formats are a power user tool IMO.

utils/zerovec/src/ule/multi.rs Show resolved Hide resolved
utils/zerovec/src/ule/tuplevar.rs Show resolved Hide resolved
fn test_tripleule_validate() {
test_tripleule_validate_inner::<Index8>();
test_tripleule_validate_inner::<Index16>();
test_tripleule_validate_inner::<Index32>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: add a test that serializing and deserializing between different formats is usually an error (unless we're unlucky and the bits are valid in both formats)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the point of a test like that. If it succeeds, it's a valid representation. We already have scattered tests that ensure that invalid types don't parse with carefully chosen non-parsing data, I don't see any benefit to writing one around swapping formats specifically.

@Manishearth Manishearth merged commit 4a69b15 into unicode-org:main Nov 13, 2024
28 checks passed
@Manishearth Manishearth deleted the makevar-format branch November 13, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants