-
Notifications
You must be signed in to change notification settings - Fork 180
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 borrowed-only versions of data structs in ZeroVec #676
Comments
Work items involved here, as an inverted dependency tree: old list
list moved to #1082 |
Writing down some of my thoughts: I feel that the For example:
Nesting:
The contract for VarZeroVec is simply that the type in the vector must be The other advantage is that by making the VarULE type front and center, we encourage developers to think in terms of the VarULE throughout their program, rather than in some other abstraction that may be less efficient or require conversions to/from the VarULE. |
Some things to make requirements of the VarULE and ULE trait
|
+1
Yes, and we should also require that the parser reject any input that is not in canonical form. For example, "1.00e3" and "10.0e2" are semantically equal, but only the former is in canonical form. With these new constraints, can people implement ULE/VarULE without any unsafe code? (Maybe except for a single "unsafe" on the trait impl to assert that all the constraints are satisfied.) |
No because they both expose |
Another potential improvement might be to get rid of AsVarULE entirely and have people directly use ULE types |
Related: type structure for ZeroMap. Removing AsVarULE requires making changes to the ZeroMap traits. (Follow-up to #1057 (comment)) |
As a part of this we should make |
Part of #1082
Depends on #1078
zerovec is capable of supporting no_std, including no heap allocations. To achieve this, we should make public versions of ZeroVec, VarZeroVec, and ZeroMap that are borrow-only.
Some caveats:
CC @Manishearth
The text was updated successfully, but these errors were encountered: