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: impl Borrow for OrderedFloat<f32> and OrderedFloat<f64> #156

Closed
wants to merge 1 commit into from

Conversation

tisonkun
Copy link
Contributor

Compiled tells the trivial result. No need for trivial tests.

This follows:

impl Borrow<f32> for NotNan<f32> {
    #[inline]
    fn borrow(&self) -> &f32 {
        &self.0
    }
}

impl Borrow<f64> for NotNan<f64> {
    #[inline]
    fn borrow(&self) -> &f64 {
        &self.0
    }
}

cc @mbrubeck

@mbrubeck
Copy link
Collaborator

mbrubeck commented Sep 25, 2024

Unfortunately, this may cause problems with type inference in some programs:

#105

I'm not sure what to do here. What is the main use case for this impl?

@tisonkun
Copy link
Contributor Author

What is the main use case for this impl?

It's not easy to describe but I use impl From<OrderedFloat<f64>> for f64 to workaround my use case.

So no need for this patch any more.

Close as there is a blocker.

@tisonkun tisonkun closed this Sep 25, 2024
@tisonkun tisonkun deleted the borrow-ordered-float branch September 25, 2024 19:39
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.

2 participants