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

Hex Strings #234

Merged
merged 10 commits into from Mar 27, 2024
Merged

Hex Strings #234

merged 10 commits into from Mar 27, 2024

Conversation

lthiery
Copy link
Collaborator

@lthiery lthiery commented Mar 26, 2024

No description provided.

plaes
plaes previously approved these changes Mar 27, 2024
@plaes
Copy link
Collaborator

plaes commented Mar 27, 2024

You may also want to revise copyright strings...

lucasgranberg
lucasgranberg previously approved these changes Mar 27, 2024
@lthiery lthiery dismissed stale reviews from lucasgranberg and plaes via 77ef338 March 27, 2024 16:22
@lthiery
Copy link
Collaborator Author

lthiery commented Mar 27, 2024

On second though, I realized feature-gating from_str was not terribly useful, so I've reorganized things so that from_str is always available.

impl std::string::ToString for $type {
fn to_string(&self) -> std::string::String {
let mut res = std::string::String::with_capacity($size * 2);
res.extend(std::iter::repeat('-').take($size * 2));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why -?
Is there a test with under- and oversized hex string?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We never assert size, but the - ensure an unwritten char would be obvious.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Concerning missized strings, good point! I'll work on that now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The hex library handles them nicely it seems

@lthiery lthiery merged commit b7d18b2 into main Mar 27, 2024
1 check passed
@lthiery lthiery deleted the lthiery/hex-strings branch March 27, 2024 17:32
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.

None yet

3 participants