-
Notifications
You must be signed in to change notification settings - Fork 111
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
Make paging state strongly typed #987
Comments
They may want to serialize paging state and deserialize it later |
Can't this be said about any struct that we intentionally restrict access to? |
No, this is actually existing use case, that's how you can implement paging e.g. in your web service. |
Then it would make sense to expose constructor ( |
What is the problem with current version (just using |
The answer is:
When I see |
Not if we provide the two functions I mentioned:
|
Yes, even then, because people use frameworks for serialization (serde, rkyv etc)
|
Now I don't understand at all. You don't want |
Perhaps I should have made this bold: I expect some shared ownership of the whole frame.
This makes huge difference when you want to have control over memory allocated:
Such precaution (about using |
User of the driver doesn't care about the frame and has no reason to think about it in terms of result frame. This is something only maintainer of this driver would do. |
As discussed face to face, deserialization refactor is going to enable the user deserialize frame subslices into |
Currently, paging state is represented both in the driver's internals and in the public API as
Bytes
blob. As it's no use allowing the users to construct paging state on their own, I suggest creating an opaque newtype for it, with a private constructor.Additionally, the core benefit that
Bytes
bring - being able to subslice a bigger allocation - does not apply in the case of paging state. I believe that paging state could be better represented asArc<[u8]>
.The text was updated successfully, but these errors were encountered: