Skip to content

Commit

Permalink
Drop the rocket_04 feature
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte committed Dec 8, 2020
1 parent 35643be commit 11973b7
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 39 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 0 additions & 30 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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);

0 comments on commit 11973b7

Please sign in to comment.