-
Notifications
You must be signed in to change notification settings - Fork 105
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
Minimal implementation of TryFromBytes
#317
Closed
joshlf
wants to merge
1
commit into
try-from-bytes-minimal-2-maybe-valid
from
try-from-bytes-minimal-3-try-from-bytes
Closed
Minimal implementation of TryFromBytes
#317
joshlf
wants to merge
1
commit into
try-from-bytes-minimal-2-maybe-valid
from
try-from-bytes-minimal-3-try-from-bytes
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 4, 2023 00:23
2019700
to
038ccb3
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
3 times, most recently
from
September 4, 2023 17:28
3802900
to
665ab99
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 4, 2023 19:25
038ccb3
to
d0ff76b
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
from
September 4, 2023 19:25
665ab99
to
ce8b5e8
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 4, 2023 19:37
d0ff76b
to
8ed6a15
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
from
September 4, 2023 19:37
ce8b5e8
to
0d31add
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 4, 2023 21:52
8ed6a15
to
b6457af
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
from
September 4, 2023 21:52
0d31add
to
52e942f
Compare
jswrenn
reviewed
Sep 5, 2023
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
2 times, most recently
from
September 5, 2023 16:45
d38f809
to
78aefe2
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 5, 2023 17:51
b6457af
to
98afbb5
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
from
September 5, 2023 17:51
78aefe2
to
56596ac
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 5, 2023 18:04
98afbb5
to
17a8cff
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
from
September 5, 2023 18:04
56596ac
to
041ef79
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 5, 2023 18:57
17a8cff
to
739d047
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
from
September 5, 2023 18:57
041ef79
to
fd5327f
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 5, 2023 20:03
739d047
to
9bc7911
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
from
September 5, 2023 20:03
fd5327f
to
9c4a7a4
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 6, 2023 01:28
9bc7911
to
4b14ee1
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
from
September 6, 2023 01:28
9c4a7a4
to
51ce251
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 6, 2023 03:25
4b14ee1
to
d32107e
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
from
September 6, 2023 03:25
51ce251
to
05003ee
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 6, 2023 03:50
d32107e
to
01345db
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
from
September 6, 2023 03:50
05003ee
to
7aff258
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 6, 2023 18:30
01345db
to
66c0c30
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
from
September 6, 2023 18:30
7aff258
to
c46c812
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 6, 2023 18:34
66c0c30
to
3115668
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
from
September 6, 2023 18:34
c46c812
to
f886e19
Compare
`TryFromBytes` can be implemented for types which are not `FromZeroes` or `FromBytes`; it supports performing a runtime check to determine whether a given byte sequence contains a valid instance of `Self`. This is the first step of #5. Future commits will add support for a custom derive and for implementing `TryFromBytes` on unsized types. TODO: Add tests Makes progress on #5
joshlf
force-pushed
the
try-from-bytes-minimal-2-maybe-valid
branch
from
September 6, 2023 18:59
3115668
to
f5fc5ba
Compare
joshlf
force-pushed
the
try-from-bytes-minimal-3-try-from-bytes
branch
from
September 6, 2023 18:59
f886e19
to
6e16ad3
Compare
joshlf
commented
Nov 2, 2023
/// implementation of `TryFromBytes::is_bit_valid`. | ||
/// | ||
/// [1] https://doc.rust-lang.org/std/primitive.char.html#method.from_u32 | ||
unsafe_impl!(char: TryFromBytes; |bytes: &[u8; 4]| { |
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.
rust-lang/reference#1401 has landed; use u32
as a representation instead.
Superseded by #353 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is a more minimal version of #279. Most notably, it doesn't rely on field projection, which was a significant source of complexity. A future PR which adds support for deriving
TryFromBytes
will need to tackle field projection.Makes progress on #5.