-
Notifications
You must be signed in to change notification settings - Fork 37
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
Provide Try{Into|From}Ctx impls for fixed byte array #93
Conversation
I just pushed a new change to this PR - which tries to fix a few merge conflicts. @m4b - I do not think the macro rules should be changed. @Frostie314159 - did you intend to change those? |
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.
@Frostie314159 i left a few feedback comments and questions, let me know what you think
@@ -1,3 +1,4 @@ | |||
#![allow(clippy::disallowed_names)] |
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'm not sure this is needed.
@@ -136,6 +137,11 @@ impl<'a> Segments<'a> { | |||
Ok(sections) | |||
} | |||
} | |||
impl<'a> Default for Segments<'a> { |
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 am not a big fan of having identical default & new -- if anything, maybe better to have the default()
, and remove new()
?
@@ -568,12 +570,12 @@ macro_rules! from_ctx_float_impl { | |||
&mut data as *mut signed_to_unsigned!($typ) as *mut u8, | |||
$size, | |||
); | |||
transmute(if le.is_little() { |
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 there a need for another transmute here?
unsafe { | ||
assert!($dst.len() >= $size); | ||
let bytes = transmute::<$typ, [u8; $size]>(if $endian.is_little() { |
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 there a need for this transmute here?
I'm sorry I'm getting very confused with what's going on with all these PRs; I think at this stage we have to have the simple PR with a single commit that just adds the impls for fixed byte arrays; I don't want to review more diffs with unrelated changes, clippy changes, etc. |
@m4b agree - I also proposed this in #86. I created this PR only to help @Frostie314159 to see what their PR actually changes compared with the main branch. There is no need to merge it. |
i see, thank you @nyurik , i'm going to go to sleep now, it's late for me, thanks for both of your hard work and PRs, much appreciated :) |
Thanks for the help! |
18d11bc
to
d369188
Compare
this is done in another pr |
This is a squashed #86. I do not think this should be merged as is because it has a few reverts and a few other unrelated things.