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: no std #78

Merged
merged 4 commits into from
Feb 21, 2025
Merged

feat: no std #78

merged 4 commits into from
Feb 21, 2025

Conversation

robjtede
Copy link
Member

@robjtede robjtede commented Feb 18, 2025

Very do-able within this crate. The biggest obstacle isn't even string or allocations, it's the lack of f64::ln() in no-std contexts.

We can calculate the ideal unit prefix with a simple loop though. I added property tests to prove that it has the same results as the ln method.

closes #3

@robjtede robjtede changed the title feat: display type feat: no std Feb 18, 2025
@robjtede robjtede force-pushed the nostd branch 3 times, most recently from 9ec33a4 to 0b5d638 Compare February 18, 2025 00:58
@robjtede robjtede linked an issue Feb 18, 2025 that may be closed by this pull request
Base automatically changed from display-type to master February 19, 2025 21:42
@robjtede robjtede requested review from hyunsik and MrCroxx February 19, 2025 21:51
@robjtede robjtede marked this pull request as ready for review February 19, 2025 21:51
@robjtede robjtede added this to the 2.0 milestone Feb 19, 2025
Copy link
Collaborator

@MrCroxx MrCroxx left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +125 to 126
#[allow(unused_variables)] // used in std contexts
let unit_base = self.format.unit_base();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we also use conditional compiling like #[cfg(feature = 'std')] here?

@robjtede robjtede merged commit a17c093 into master Feb 21, 2025
11 checks passed
@robjtede robjtede deleted the nostd branch February 21, 2025 11:36
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.

Support no_std usage
2 participants