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

Move zval value coercing into FromZval #84

Open
davidcole1340 opened this issue Oct 1, 2021 · 0 comments
Open

Move zval value coercing into FromZval #84

davidcole1340 opened this issue Oct 1, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@davidcole1340
Copy link
Owner

At the moment, calling zval.string() will attempt to convert a f64 into a string, so zval.string() != zval.str() all the time. This should be removed, and a new function added to FromZval, coerce_from_zval():

pub trait FromZval<'a> {
    fn from_zval(zval: &'a Zval) -> Option<Self>;
    // by default, most types won't need coercing
    fn coerce_from_zval(zval: &'a Zval) -> Option<Self> {
        Self::from_zval(zval)
    }
}
@davidcole1340 davidcole1340 added the enhancement New feature or request label Oct 1, 2021
@davidcole1340 davidcole1340 linked a pull request Oct 1, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant