Merge #57
57: Update the url crate to 2.0 r=nox a=SimonSapin Co-authored-by: Simon Sapin <simon.sapin@exyr.org>
This commit is contained in:
commit
68113de90f
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde_urlencoded"
|
name = "serde_urlencoded"
|
||||||
version = "0.5.5"
|
version = "0.6.0"
|
||||||
authors = ["Anthony Ramine <n.oxyde@gmail.com>"]
|
authors = ["Anthony Ramine <n.oxyde@gmail.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
repository = "https://github.com/nox/serde_urlencoded"
|
repository = "https://github.com/nox/serde_urlencoded"
|
||||||
@ -19,7 +19,7 @@ test = false
|
|||||||
dtoa = "0.4.0"
|
dtoa = "0.4.0"
|
||||||
itoa = "0.4.0"
|
itoa = "0.4.0"
|
||||||
serde = "1.0.0"
|
serde = "1.0.0"
|
||||||
url = "1.0.0"
|
url = "2.0.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
|
@ -43,12 +43,12 @@ pub fn to_string<T: ser::Serialize>(input: T) -> Result<String, Error> {
|
|||||||
///
|
///
|
||||||
/// * Newtype structs defer to their inner values.
|
/// * Newtype structs defer to their inner values.
|
||||||
pub struct Serializer<'output, Target: 'output + UrlEncodedTarget> {
|
pub struct Serializer<'output, Target: 'output + UrlEncodedTarget> {
|
||||||
urlencoder: &'output mut UrlEncodedSerializer<Target>,
|
urlencoder: &'output mut UrlEncodedSerializer<'static, Target>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'output, Target: 'output + UrlEncodedTarget> Serializer<'output, Target> {
|
impl<'output, Target: 'output + UrlEncodedTarget> Serializer<'output, Target> {
|
||||||
/// Returns a new `Serializer`.
|
/// Returns a new `Serializer`.
|
||||||
pub fn new(urlencoder: &'output mut UrlEncodedSerializer<Target>) -> Self {
|
pub fn new(urlencoder: &'output mut UrlEncodedSerializer<'static, Target>) -> Self {
|
||||||
Serializer {
|
Serializer {
|
||||||
urlencoder: urlencoder,
|
urlencoder: urlencoder,
|
||||||
}
|
}
|
||||||
@ -96,53 +96,53 @@ impl ser::Error for Error {
|
|||||||
|
|
||||||
/// Sequence serializer.
|
/// Sequence serializer.
|
||||||
pub struct SeqSerializer<'output, Target: 'output + UrlEncodedTarget> {
|
pub struct SeqSerializer<'output, Target: 'output + UrlEncodedTarget> {
|
||||||
urlencoder: &'output mut UrlEncodedSerializer<Target>,
|
urlencoder: &'output mut UrlEncodedSerializer<'static, Target>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tuple serializer.
|
/// Tuple serializer.
|
||||||
///
|
///
|
||||||
/// Mostly used for arrays.
|
/// Mostly used for arrays.
|
||||||
pub struct TupleSerializer<'output, Target: 'output + UrlEncodedTarget> {
|
pub struct TupleSerializer<'output, Target: 'output + UrlEncodedTarget> {
|
||||||
urlencoder: &'output mut UrlEncodedSerializer<Target>,
|
urlencoder: &'output mut UrlEncodedSerializer<'static, Target>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tuple struct serializer.
|
/// Tuple struct serializer.
|
||||||
///
|
///
|
||||||
/// Never instantiated, tuple structs are not supported.
|
/// Never instantiated, tuple structs are not supported.
|
||||||
pub struct TupleStructSerializer<'output, T: 'output + UrlEncodedTarget> {
|
pub struct TupleStructSerializer<'output, T: 'output + UrlEncodedTarget> {
|
||||||
inner: ser::Impossible<&'output mut UrlEncodedSerializer<T>, Error>,
|
inner: ser::Impossible<&'output mut UrlEncodedSerializer<'static, T>, Error>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tuple variant serializer.
|
/// Tuple variant serializer.
|
||||||
///
|
///
|
||||||
/// Never instantiated, tuple variants are not supported.
|
/// Never instantiated, tuple variants are not supported.
|
||||||
pub struct TupleVariantSerializer<'output, T: 'output + UrlEncodedTarget> {
|
pub struct TupleVariantSerializer<'output, T: 'output + UrlEncodedTarget> {
|
||||||
inner: ser::Impossible<&'output mut UrlEncodedSerializer<T>, Error>,
|
inner: ser::Impossible<&'output mut UrlEncodedSerializer<'static, T>, Error>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Map serializer.
|
/// Map serializer.
|
||||||
pub struct MapSerializer<'output, Target: 'output + UrlEncodedTarget> {
|
pub struct MapSerializer<'output, Target: 'output + UrlEncodedTarget> {
|
||||||
urlencoder: &'output mut UrlEncodedSerializer<Target>,
|
urlencoder: &'output mut UrlEncodedSerializer<'static, Target>,
|
||||||
key: Option<Cow<'static, str>>,
|
key: Option<Cow<'static, str>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Struct serializer.
|
/// Struct serializer.
|
||||||
pub struct StructSerializer<'output, Target: 'output + UrlEncodedTarget> {
|
pub struct StructSerializer<'output, Target: 'output + UrlEncodedTarget> {
|
||||||
urlencoder: &'output mut UrlEncodedSerializer<Target>,
|
urlencoder: &'output mut UrlEncodedSerializer<'static, Target>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Struct variant serializer.
|
/// Struct variant serializer.
|
||||||
///
|
///
|
||||||
/// Never instantiated, struct variants are not supported.
|
/// Never instantiated, struct variants are not supported.
|
||||||
pub struct StructVariantSerializer<'output, T: 'output + UrlEncodedTarget> {
|
pub struct StructVariantSerializer<'output, T: 'output + UrlEncodedTarget> {
|
||||||
inner: ser::Impossible<&'output mut UrlEncodedSerializer<T>, Error>,
|
inner: ser::Impossible<&'output mut UrlEncodedSerializer<'static, T>, Error>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'output, Target> ser::Serializer for Serializer<'output, Target>
|
impl<'output, Target> ser::Serializer for Serializer<'output, Target>
|
||||||
where
|
where
|
||||||
Target: 'output + UrlEncodedTarget,
|
Target: 'output + UrlEncodedTarget,
|
||||||
{
|
{
|
||||||
type Ok = &'output mut UrlEncodedSerializer<Target>;
|
type Ok = &'output mut UrlEncodedSerializer<'static, Target>;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
type SerializeSeq = SeqSerializer<'output, Target>;
|
type SerializeSeq = SeqSerializer<'output, Target>;
|
||||||
type SerializeTuple = TupleSerializer<'output, Target>;
|
type SerializeTuple = TupleSerializer<'output, Target>;
|
||||||
@ -356,7 +356,7 @@ impl<'output, Target> ser::SerializeSeq for SeqSerializer<'output, Target>
|
|||||||
where
|
where
|
||||||
Target: 'output + UrlEncodedTarget,
|
Target: 'output + UrlEncodedTarget,
|
||||||
{
|
{
|
||||||
type Ok = &'output mut UrlEncodedSerializer<Target>;
|
type Ok = &'output mut UrlEncodedSerializer<'static, Target>;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
fn serialize_element<T: ?Sized + ser::Serialize>(
|
fn serialize_element<T: ?Sized + ser::Serialize>(
|
||||||
@ -375,7 +375,7 @@ impl<'output, Target> ser::SerializeTuple for TupleSerializer<'output, Target>
|
|||||||
where
|
where
|
||||||
Target: 'output + UrlEncodedTarget,
|
Target: 'output + UrlEncodedTarget,
|
||||||
{
|
{
|
||||||
type Ok = &'output mut UrlEncodedSerializer<Target>;
|
type Ok = &'output mut UrlEncodedSerializer<'static, Target>;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
fn serialize_element<T: ?Sized + ser::Serialize>(
|
fn serialize_element<T: ?Sized + ser::Serialize>(
|
||||||
@ -395,7 +395,7 @@ impl<'output, Target> ser::SerializeTupleStruct
|
|||||||
where
|
where
|
||||||
Target: 'output + UrlEncodedTarget,
|
Target: 'output + UrlEncodedTarget,
|
||||||
{
|
{
|
||||||
type Ok = &'output mut UrlEncodedSerializer<Target>;
|
type Ok = &'output mut UrlEncodedSerializer<'static, Target>;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
fn serialize_field<T: ?Sized + ser::Serialize>(
|
fn serialize_field<T: ?Sized + ser::Serialize>(
|
||||||
@ -415,7 +415,7 @@ impl<'output, Target> ser::SerializeTupleVariant
|
|||||||
where
|
where
|
||||||
Target: 'output + UrlEncodedTarget,
|
Target: 'output + UrlEncodedTarget,
|
||||||
{
|
{
|
||||||
type Ok = &'output mut UrlEncodedSerializer<Target>;
|
type Ok = &'output mut UrlEncodedSerializer<'static, Target>;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
fn serialize_field<T: ?Sized + ser::Serialize>(
|
fn serialize_field<T: ?Sized + ser::Serialize>(
|
||||||
@ -434,7 +434,7 @@ impl<'output, Target> ser::SerializeMap for MapSerializer<'output, Target>
|
|||||||
where
|
where
|
||||||
Target: 'output + UrlEncodedTarget,
|
Target: 'output + UrlEncodedTarget,
|
||||||
{
|
{
|
||||||
type Ok = &'output mut UrlEncodedSerializer<Target>;
|
type Ok = &'output mut UrlEncodedSerializer<'static, Target>;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
fn serialize_entry<
|
fn serialize_entry<
|
||||||
@ -487,7 +487,7 @@ impl<'output, Target> ser::SerializeStruct for StructSerializer<'output, Target>
|
|||||||
where
|
where
|
||||||
Target: 'output + UrlEncodedTarget,
|
Target: 'output + UrlEncodedTarget,
|
||||||
{
|
{
|
||||||
type Ok = &'output mut UrlEncodedSerializer<Target>;
|
type Ok = &'output mut UrlEncodedSerializer<'static, Target>;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
fn serialize_field<T: ?Sized + ser::Serialize>(
|
fn serialize_field<T: ?Sized + ser::Serialize>(
|
||||||
@ -509,7 +509,7 @@ impl<'output, Target> ser::SerializeStructVariant
|
|||||||
where
|
where
|
||||||
Target: 'output + UrlEncodedTarget,
|
Target: 'output + UrlEncodedTarget,
|
||||||
{
|
{
|
||||||
type Ok = &'output mut UrlEncodedSerializer<Target>;
|
type Ok = &'output mut UrlEncodedSerializer<'static, Target>;
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
fn serialize_field<T: ?Sized + ser::Serialize>(
|
fn serialize_field<T: ?Sized + ser::Serialize>(
|
||||||
|
@ -9,7 +9,7 @@ use url::form_urlencoded::Serializer as UrlEncodedSerializer;
|
|||||||
use url::form_urlencoded::Target as UrlEncodedTarget;
|
use url::form_urlencoded::Target as UrlEncodedTarget;
|
||||||
|
|
||||||
pub struct PairSerializer<'target, Target: 'target + UrlEncodedTarget> {
|
pub struct PairSerializer<'target, Target: 'target + UrlEncodedTarget> {
|
||||||
urlencoder: &'target mut UrlEncodedSerializer<Target>,
|
urlencoder: &'target mut UrlEncodedSerializer<'static, Target>,
|
||||||
state: PairState,
|
state: PairState,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ impl<'target, Target> PairSerializer<'target, Target>
|
|||||||
where
|
where
|
||||||
Target: 'target + UrlEncodedTarget,
|
Target: 'target + UrlEncodedTarget,
|
||||||
{
|
{
|
||||||
pub fn new(urlencoder: &'target mut UrlEncodedSerializer<Target>) -> Self {
|
pub fn new(urlencoder: &'target mut UrlEncodedSerializer<'static, Target>) -> Self {
|
||||||
PairSerializer {
|
PairSerializer {
|
||||||
urlencoder: urlencoder,
|
urlencoder: urlencoder,
|
||||||
state: PairState::WaitingForKey,
|
state: PairState::WaitingForKey,
|
||||||
|
@ -9,7 +9,7 @@ pub struct ValueSink<'key, 'target, Target>
|
|||||||
where
|
where
|
||||||
Target: 'target + UrlEncodedTarget,
|
Target: 'target + UrlEncodedTarget,
|
||||||
{
|
{
|
||||||
urlencoder: &'target mut UrlEncodedSerializer<Target>,
|
urlencoder: &'target mut UrlEncodedSerializer<'static, Target>,
|
||||||
key: &'key str,
|
key: &'key str,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ where
|
|||||||
Target: 'target + UrlEncodedTarget,
|
Target: 'target + UrlEncodedTarget,
|
||||||
{
|
{
|
||||||
pub fn new(
|
pub fn new(
|
||||||
urlencoder: &'target mut UrlEncodedSerializer<Target>,
|
urlencoder: &'target mut UrlEncodedSerializer<'static, Target>,
|
||||||
key: &'key str,
|
key: &'key str,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
ValueSink {
|
ValueSink {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user