Do not forbid bool keys anymore

Floats are supported so...
This commit is contained in:
Anthony Ramine 2017-01-29 00:17:54 +01:00
parent 5625c254e5
commit f5b1ae8828
3 changed files with 1 additions and 11 deletions

View File

@ -46,10 +46,6 @@ impl<End, Ok> Sink for KeySink<End>
{
type Ok = Ok;
fn serialize_bool(self, _value: bool) -> Result<Ok, Error> {
Err(self.unsupported())
}
fn serialize_static_str(self,
value: &'static str)
-> Result<Ok, Error> {

View File

@ -18,8 +18,6 @@ impl<S: Sink> PartSerializer<S> {
pub trait Sink: Sized {
type Ok;
fn serialize_bool(self, value: bool) -> Result<Self::Ok, Error>;
fn serialize_static_str(self,
value: &'static str)
-> Result<Self::Ok, Error>;
@ -48,7 +46,7 @@ impl<S: Sink> ser::Serializer for PartSerializer<S> {
type SerializeStructVariant = VoidSerializer<S::Ok>;
fn serialize_bool(self, v: bool) -> Result<S::Ok, Error> {
self.sink.serialize_bool(v)
self.sink.serialize_static_str(if v { "true" } else { "false" })
}
fn serialize_i8(self, v: i8) -> Result<S::Ok, Error> {

View File

@ -30,10 +30,6 @@ impl<'key, 'target, Target> Sink for ValueSink<'key, 'target, Target>
{
type Ok = ();
fn serialize_bool(self, value: bool) -> Result<Self::Ok, Error> {
self.serialize_static_str(if value { "true" } else { "false" })
}
fn serialize_str(self, value: &str) -> Result<(), Error> {
self.urlencoder.append_pair(self.key, value);
Ok(())