~jplatte/js_int

11973b723319208d7412ea57de823b81daebcaf4 — Jonas Platte 5 months ago 35643be
Drop the rocket_04 feature
4 files changed, 2 insertions(+), 39 deletions(-)

M CHANGELOG.md
M Cargo.toml
M README.md
M src/lib.rs
M CHANGELOG.md => CHANGELOG.md +2 -0
@@ 1,6 1,8 @@
# 0.2.0 (unreleased)

* Bump MSRV to 1.35
* Drop support for the `rocket_04` Cargo feature (Rocket 0.4 `FromFormValue` / `FromParam`
  implementations)

# 0.1.9


M Cargo.toml => Cargo.toml +0 -5
@@ 10,11 10,6 @@ repository = "https://git.sr.ht/~jplatte/js_int"
keywords = ["integer", "no_std"]
categories = ["no-std"]

[dependencies.rocket_04]
package = "rocket"
version = "0.4"
optional = true

[dependencies.serde]
version = "1.0"
optional = true

M README.md => README.md +0 -4
@@ 40,10 40,6 @@ fractional part is discarded. Please be aware that `serde_json` doesn't
losslessly parse large floats with a fractional part by default (even if the
fractional part is `.0`). To fix that, enable its `float_roundtrip` feature.

Deserialization of `Int` and `UInt` form values and path parameters for users
of the Rocket web framework version 0.4 are supported via the `rocket_04`
feature.

[travis]: https://travis-ci.org/jplatte/js_int
[crates-io]: https://crates.io/crates/js_int
[docs-rs]: https://docs.rs/js_int

M src/lib.rs => src/lib.rs +0 -30
@@ 25,8 25,6 @@
//!
//! # Features
//!
//! * `rocket_04`: Deserialization support from form values (`impl FromFormValue`) and path segments
//!   (`impl FromParam`) for users of the Rocket web framework version 0.4. Disabled by default.
//! * `serde`: Serialization and deserialization support via [serde](https://serde.rs). Disabled by
//!   default. You can use `js_int` + `serde` in `#![no_std]` contexts if you use
//!   `default-features = false` for both.


@@ 52,31 50,3 @@ pub use self::{
    int::{Int, MAX_SAFE_INT, MIN_SAFE_INT},
    uint::{UInt, MAX_SAFE_UINT},
};

#[cfg(feature = "rocket_04")]
macro_rules! rocket_04_impls {
    ($type:ident) => {
        impl<'v> rocket_04::request::FromFormValue<'v> for $type {
            type Error = &'v rocket_04::http::RawStr;

            fn from_form_value(
                form_value: &'v rocket_04::http::RawStr,
            ) -> Result<Self, Self::Error> {
                form_value.parse::<$type>().map_err(|_| form_value)
            }
        }

        impl<'r> rocket_04::request::FromParam<'r> for $type {
            type Error = &'r rocket_04::http::RawStr;

            fn from_param(param: &'r rocket_04::http::RawStr) -> Result<Self, Self::Error> {
                param.parse::<$type>().map_err(|_| param)
            }
        }
    };
}

#[cfg(feature = "rocket_04")]
rocket_04_impls!(Int);
#[cfg(feature = "rocket_04")]
rocket_04_impls!(UInt);