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

Implement FromStr for big-sized num types #6

Open
dr-orlovsky opened this issue May 17, 2021 · 2 comments
Open

Implement FromStr for big-sized num types #6

dr-orlovsky opened this issue May 17, 2021 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@dr-orlovsky
Copy link
Member

No description provided.

@dr-orlovsky dr-orlovsky added enhancement New feature or request good first issue Good for newcomers labels May 17, 2021
@dr-orlovsky dr-orlovsky changed the title Implement FromStr for small int bit-sized types Implement FromStr for big-sized num types May 17, 2021
@josediegorobles
Copy link
Contributor

Hi,

It can be something like this?

impl ::core::str::FromStr for $name { #[inline] fn from_str(s: &str) -> Result<Self, Self::Err> { let splitted = s.split("0x"); let inner_big_int: Vec<u64> = splitted.map(|x| format!("0x{}", x)). map(|x| x.parse::<u64>().unwrap()). collect(); let inner_big_int_array = inner_big_int.try_into().unwrap(); Ok(Self(inner_big_int_array)) } }

@dr-orlovsky
Copy link
Member Author

Thank you for grabbing the issue! Commenting in the PR itself

@dr-orlovsky dr-orlovsky transferred this issue from rust-amplify/rust-amplify Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: 📋 Backlog
Development

Successfully merging a pull request may close this issue.

2 participants