mirror of https://github.com/rwf2/Rocket.git
Use 'dep' syntax for 'http' features.
This commit is contained in:
parent
84072a813a
commit
e6aaea072c
|
@ -17,8 +17,8 @@ rust-version = "1.75"
|
|||
|
||||
[features]
|
||||
default = []
|
||||
serde = ["uncased/with-serde-alloc", "serde_"]
|
||||
uuid = ["uuid_"]
|
||||
serde = ["dep:serde", "uncased/with-serde-alloc"]
|
||||
uuid = ["dep:uuid"]
|
||||
|
||||
[lints.clippy]
|
||||
module_inception = "allow"
|
||||
|
@ -39,15 +39,13 @@ stable-pattern = "0.1"
|
|||
cookie = { version = "0.18", features = ["percent-encode"] }
|
||||
state = "0.6"
|
||||
|
||||
[dependencies.serde_]
|
||||
package = "serde"
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
optional = true
|
||||
default-features = false
|
||||
features = ["std"]
|
||||
|
||||
[dependencies.uuid_]
|
||||
package = "uuid"
|
||||
[dependencies.uuid]
|
||||
version = "1"
|
||||
optional = true
|
||||
default-features = false
|
||||
|
|
|
@ -73,13 +73,12 @@ macro_rules! define_methods {
|
|||
/// from either `"GET"` or `"get"` but not `"GeT"`.
|
||||
///
|
||||
/// ```rust
|
||||
/// # #[cfg(feature = "serde")] mod serde {
|
||||
/// # use serde_ as serde;
|
||||
/// use serde::{Serialize, Deserialize};
|
||||
/// # #[cfg(feature = "serde")] mod serde_impl {
|
||||
/// use rocket::http::Method;
|
||||
/// use rocket::serde::{Serialize, Deserialize};
|
||||
///
|
||||
/// #[derive(Deserialize, Serialize)]
|
||||
/// # #[serde(crate = "serde_")]
|
||||
/// #[serde(crate = "rocket::serde")]
|
||||
/// struct Foo {
|
||||
/// method: Method,
|
||||
/// }
|
||||
|
@ -357,11 +356,11 @@ impl PartialEq<Method> for &Method {
|
|||
}
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
mod serde {
|
||||
mod serde_impl {
|
||||
use super::*;
|
||||
|
||||
use serde_::ser::{Serialize, Serializer};
|
||||
use serde_::de::{Deserialize, Deserializer, Error, Visitor, Unexpected};
|
||||
use serde::ser::{Serialize, Serializer};
|
||||
use serde::de::{Deserialize, Deserializer, Error, Visitor, Unexpected};
|
||||
|
||||
impl Serialize for Method {
|
||||
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
|
|
|
@ -901,8 +901,8 @@ impl RawStr {
|
|||
}
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
mod serde {
|
||||
use serde_::{ser, de, Serialize, Deserialize};
|
||||
mod serde_impl {
|
||||
use serde::{ser, de, Serialize, Deserialize};
|
||||
|
||||
use super::*;
|
||||
|
||||
|
|
|
@ -100,13 +100,13 @@ impl StatusClass {
|
|||
/// range `[100, 600)` is allowed to deserialize into a `Status`.`
|
||||
///
|
||||
/// ```rust
|
||||
/// # #[cfg(feature = "serde")] mod serde {
|
||||
/// # use serde_ as serde;
|
||||
/// # #[cfg(feature = "serde")] mod serde_impl {
|
||||
/// # use serde as serde;
|
||||
/// use serde::{Serialize, Deserialize};
|
||||
/// use rocket::http::Status;
|
||||
///
|
||||
/// #[derive(Deserialize, Serialize)]
|
||||
/// # #[serde(crate = "serde_")]
|
||||
/// # #[serde(crate = "serde")]
|
||||
/// struct Foo {
|
||||
/// status: Status,
|
||||
/// }
|
||||
|
@ -381,11 +381,11 @@ impl Ord for Status {
|
|||
}
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
mod serde {
|
||||
mod serde_impl {
|
||||
use super::*;
|
||||
|
||||
use serde_::ser::{Serialize, Serializer};
|
||||
use serde_::de::{Deserialize, Deserializer, Error, Visitor, Unexpected};
|
||||
use serde::ser::{Serialize, Serializer};
|
||||
use serde::de::{Deserialize, Deserializer, Error, Visitor, Unexpected};
|
||||
|
||||
impl Serialize for Status {
|
||||
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
|
|
|
@ -72,19 +72,19 @@ use crate::uri::{Authority, Path, Query, Data, Error, as_utf8_unchecked, fmt};
|
|||
/// `Absolute` is both `Serialize` and `Deserialize`:
|
||||
///
|
||||
/// ```rust
|
||||
/// # #[cfg(feature = "serde")] mod serde {
|
||||
/// # use serde_ as serde;
|
||||
/// # #[cfg(feature = "serde")] mod serde_impl {
|
||||
/// # use serde as serde;
|
||||
/// use serde::{Serialize, Deserialize};
|
||||
/// use rocket::http::uri::Absolute;
|
||||
///
|
||||
/// #[derive(Deserialize, Serialize)]
|
||||
/// # #[serde(crate = "serde_")]
|
||||
/// # #[serde(crate = "serde")]
|
||||
/// struct UriOwned {
|
||||
/// uri: Absolute<'static>,
|
||||
/// }
|
||||
///
|
||||
/// #[derive(Deserialize, Serialize)]
|
||||
/// # #[serde(crate = "serde_")]
|
||||
/// # #[serde(crate = "serde")]
|
||||
/// struct UriBorrowed<'a> {
|
||||
/// uri: Absolute<'a>,
|
||||
/// }
|
||||
|
|
|
@ -8,13 +8,13 @@ use crate::uri::Error;
|
|||
/// `Asterisk` is both `Serialize` and `Deserialize`:
|
||||
///
|
||||
/// ```rust
|
||||
/// # #[cfg(feature = "serde")] mod serde {
|
||||
/// # use serde_ as serde;
|
||||
/// # #[cfg(feature = "serde")] mod serde_impl {
|
||||
/// # use serde as serde;
|
||||
/// use serde::{Serialize, Deserialize};
|
||||
/// use rocket::http::uri::Asterisk;
|
||||
///
|
||||
/// #[derive(Deserialize, Serialize)]
|
||||
/// # #[serde(crate = "serde_")]
|
||||
/// # #[serde(crate = "serde")]
|
||||
/// struct UriOwned {
|
||||
/// uri: Asterisk,
|
||||
/// }
|
||||
|
|
|
@ -25,19 +25,19 @@ use crate::uri::{as_utf8_unchecked, error::Error};
|
|||
/// `Authority` is both `Serialize` and `Deserialize`:
|
||||
///
|
||||
/// ```rust
|
||||
/// # #[cfg(feature = "serde")] mod serde {
|
||||
/// # use serde_ as serde;
|
||||
/// # #[cfg(feature = "serde")] mod serde_impl {
|
||||
/// # use serde as serde;
|
||||
/// use serde::{Serialize, Deserialize};
|
||||
/// use rocket::http::uri::Authority;
|
||||
///
|
||||
/// #[derive(Deserialize, Serialize)]
|
||||
/// # #[serde(crate = "serde_")]
|
||||
/// # #[serde(crate = "serde")]
|
||||
/// struct UriOwned {
|
||||
/// uri: Authority<'static>,
|
||||
/// }
|
||||
///
|
||||
/// #[derive(Deserialize, Serialize)]
|
||||
/// # #[serde(crate = "serde_")]
|
||||
/// # #[serde(crate = "serde")]
|
||||
/// struct UriBorrowed<'a> {
|
||||
/// uri: Authority<'a>,
|
||||
/// }
|
||||
|
|
|
@ -505,8 +505,8 @@ impl<K: UriDisplay<Query>, V: UriDisplay<Query>> UriDisplay<Query> for BTreeMap<
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "uuid")] impl_with_display!(uuid_::Uuid);
|
||||
#[cfg(feature = "uuid")] crate::impl_from_uri_param_identity!(uuid_::Uuid);
|
||||
#[cfg(feature = "uuid")] impl_with_display!(uuid::Uuid);
|
||||
#[cfg(feature = "uuid")] crate::impl_from_uri_param_identity!(uuid::Uuid);
|
||||
|
||||
// And finally, the `Ignorable` trait, which has sugar of `_` in the `uri!`
|
||||
// macro, which expands to a typecheck.
|
||||
|
|
|
@ -69,19 +69,19 @@ use crate::uri::{Absolute, Authority};
|
|||
/// `Host` is both `Serialize` and `Deserialize`:
|
||||
///
|
||||
/// ```rust
|
||||
/// # #[cfg(feature = "serde")] mod serde {
|
||||
/// # use serde_ as serde;
|
||||
/// # #[cfg(feature = "serde")] mod serde_impl {
|
||||
/// # use serde as serde;
|
||||
/// use serde::{Serialize, Deserialize};
|
||||
/// use rocket::http::uri::Host;
|
||||
///
|
||||
/// #[derive(Deserialize, Serialize)]
|
||||
/// # #[serde(crate = "serde_")]
|
||||
/// # #[serde(crate = "serde")]
|
||||
/// struct UriOwned {
|
||||
/// uri: Host<'static>,
|
||||
/// }
|
||||
///
|
||||
/// #[derive(Deserialize, Serialize)]
|
||||
/// # #[serde(crate = "serde_")]
|
||||
/// # #[serde(crate = "serde")]
|
||||
/// struct UriBorrowed<'a> {
|
||||
/// uri: Host<'a>,
|
||||
/// }
|
||||
|
|
|
@ -93,19 +93,19 @@ use crate::{RawStr, RawStrBuf};
|
|||
/// `Origin` is both `Serialize` and `Deserialize`:
|
||||
///
|
||||
/// ```rust
|
||||
/// # #[cfg(feature = "serde")] mod serde {
|
||||
/// # use serde_ as serde;
|
||||
/// # #[cfg(feature = "serde")] mod serde_impl {
|
||||
/// # use serde as serde;
|
||||
/// use serde::{Serialize, Deserialize};
|
||||
/// use rocket::http::uri::Origin;
|
||||
///
|
||||
/// #[derive(Deserialize, Serialize)]
|
||||
/// # #[serde(crate = "serde_")]
|
||||
/// # #[serde(crate = "serde")]
|
||||
/// struct UriOwned {
|
||||
/// uri: Origin<'static>,
|
||||
/// }
|
||||
///
|
||||
/// #[derive(Deserialize, Serialize)]
|
||||
/// # #[serde(crate = "serde_")]
|
||||
/// # #[serde(crate = "serde")]
|
||||
/// struct UriBorrowed<'a> {
|
||||
/// uri: Origin<'a>,
|
||||
/// }
|
||||
|
|
|
@ -51,19 +51,19 @@ use crate::parse::{Extent, IndexedStr};
|
|||
/// `Reference` is both `Serialize` and `Deserialize`:
|
||||
///
|
||||
/// ```rust
|
||||
/// # #[cfg(feature = "serde")] mod serde {
|
||||
/// # use serde_ as serde;
|
||||
/// # #[cfg(feature = "serde")] mod serde_impl {
|
||||
/// # use serde as serde;
|
||||
/// use serde::{Serialize, Deserialize};
|
||||
/// use rocket::http::uri::Reference;
|
||||
///
|
||||
/// #[derive(Deserialize, Serialize)]
|
||||
/// # #[serde(crate = "serde_")]
|
||||
/// # #[serde(crate = "serde")]
|
||||
/// struct UriOwned {
|
||||
/// uri: Reference<'static>,
|
||||
/// }
|
||||
///
|
||||
/// #[derive(Deserialize, Serialize)]
|
||||
/// # #[serde(crate = "serde_")]
|
||||
/// # #[serde(crate = "serde")]
|
||||
/// struct UriBorrowed<'a> {
|
||||
/// uri: Reference<'a>,
|
||||
/// }
|
||||
|
|
|
@ -365,13 +365,13 @@ impl_uri_from!(Asterisk);
|
|||
macro_rules! impl_serde {
|
||||
($T:ty, $expected:literal) => {
|
||||
#[cfg(feature = "serde")]
|
||||
mod serde {
|
||||
mod serde_impl {
|
||||
use std::fmt;
|
||||
use std::marker::PhantomData;
|
||||
use super::*;
|
||||
|
||||
use serde_::ser::{Serialize, Serializer};
|
||||
use serde_::de::{Deserialize, Deserializer, Error, Visitor};
|
||||
use serde::ser::{Serialize, Serializer};
|
||||
use serde::de::{Deserialize, Deserializer, Error, Visitor};
|
||||
|
||||
impl<'a> Serialize for $T {
|
||||
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
|
|
Loading…
Reference in New Issue