Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

nyurik
Copy link
Contributor

@nyurik nyurik commented Nov 20, 2023

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.

@nyurik
Copy link
Contributor Author

nyurik commented Nov 20, 2023

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?

Copy link
Contributor Author

@nyurik nyurik left a 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)]
Copy link
Contributor Author

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> {
Copy link
Contributor Author

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() {
Copy link
Contributor Author

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() {
Copy link
Contributor Author

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?

@m4b
Copy link
Owner

m4b commented Nov 20, 2023

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.

@nyurik
Copy link
Contributor Author

nyurik commented Nov 20, 2023

@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.

@m4b
Copy link
Owner

m4b commented Nov 20, 2023

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 :)

@Frostie314159
Copy link
Contributor

Thanks for the help!

@m4b m4b force-pushed the master branch 2 times, most recently from 18d11bc to d369188 Compare January 1, 2024 00:12
@m4b
Copy link
Owner

m4b commented Jan 1, 2024

this is done in another pr

@m4b m4b closed this Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants