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

feat(primitives): fixed bytes macros #156

Merged
merged 3 commits into from
Jun 27, 2023
Merged

feat(primitives): fixed bytes macros #156

merged 3 commits into from
Jun 27, 2023

Conversation

DaniPopes
Copy link
Member

@DaniPopes DaniPopes commented Jun 26, 2023

Motivation

Closes #109

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@DaniPopes DaniPopes marked this pull request as ready for review June 26, 2023 22:10
Copy link
Member

@prestwich prestwich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dope

Self(FixedBytes(hash[12..].try_into().unwrap()))
#[must_use]
pub fn from_word(word: FixedBytes<32>) -> Self {
Self(FixedBytes(word[12..].try_into().unwrap()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider for a future PR:
should this error if the top bytes are dirty?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In another method maybe

@DaniPopes DaniPopes merged commit f18b92f into main Jun 27, 2023
@DaniPopes DaniPopes deleted the dani/byte-macros branch June 27, 2023 15:19
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.

[Feature] Add FixedBytes and aliases macros
2 participants