Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Implementing get_size for everything #197
Implementing get_size for everything #197
Changes from 2 commits
2274735
33288ba
84758e9
5243ba0
d25710d
d8aae30
55f12f6
f35402b
146c593
1e9f3aa
8c3e9d9
e97959b
15b9054
33b5220
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
is this really 1 or since there's no
None
, is it each plugin's initial size?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.
There's still one byte required for the plugin enum discriminator.
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.
Right but there's no default value that is only the descriminator, so there's no time you could ever use
BASE_LEN
and it would be correct, right?Whereas for example
Attribute
, theBASE_LEN
would be the length of an empty key/value pair and you could call it for a default value.I can't think of a good solution for this except for adding a
None
variant, which is a contrived solution as there's not an actual reason to add itThere 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 yeah I see what you mean. Maybe BASE_LEN should be private or not required?
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.
I like that idea of not having
BASE_LEN
as a public trait const, and then people should only ever uselen()
which would work for empty or non-empty items. Like len() should always be trustable.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.
It's a little annoying when we have multi-level data blobs, still. Because with no public BASE_LEN you need to hard code the underlying type's size.