diff options
author | bors-ng[bot] <bors-ng[bot]@users.noreply.github.com> | 2017-01-31 09:59:17 +0000 |
---|---|---|
committer | bors-ng[bot] <bors-ng[bot]@users.noreply.github.com> | 2017-01-31 09:59:17 +0000 |
commit | 4ef7cc6e85a3c17f341c3308b60e227e27e5e305 (patch) | |
tree | 7d38a9c38d48c855d806c77533929bdb085f6a01 /src/ser/void.rs | |
parent | 2cc32847ac45bee7d0b60020edda3cce7a07b4ce (diff) | |
parent | b24505bcfed47b88c1f2aa13c8743aa4b4cd2c3f (diff) |
Merge #11
11: Update serde to 0.9.3 and use serde::ser::Impossible
Diffstat (limited to 'src/ser/void.rs')
-rw-r--r-- | src/ser/void.rs | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/src/ser/void.rs b/src/ser/void.rs deleted file mode 100644 index 4765bb7..0000000 --- a/src/ser/void.rs +++ /dev/null @@ -1,122 +0,0 @@ -use ser::Error; -use serde::ser; -use std::marker::PhantomData; -use void; - -pub struct VoidSerializer<Ok> { - void: void::Void, - _marker: PhantomData<Ok>, -} - -impl<Ok> ser::SerializeSeq for VoidSerializer<Ok> { - type Ok = Ok; - type Error = Error; - - fn serialize_element<T: ?Sized + ser::Serialize>(&mut self, - _value: &T) - -> Result<(), Error> { - void::unreachable(self.void) - } - - fn end(self) -> Result<Ok, Error> { - void::unreachable(self.void) - } -} - -impl<Ok> ser::SerializeTuple for VoidSerializer<Ok> { - type Ok = Ok; - type Error = Error; - - fn serialize_element<T: ?Sized + ser::Serialize>(&mut self, - _value: &T) - -> Result<(), Error> { - void::unreachable(self.void) - } - - fn end(self) -> Result<Ok, Error> { - void::unreachable(self.void) - } -} - -impl<Ok> ser::SerializeTupleStruct for VoidSerializer<Ok> { - type Ok = Ok; - type Error = Error; - - fn serialize_field<T: ?Sized + ser::Serialize>(&mut self, - _value: &T) - -> Result<(), Error> { - void::unreachable(self.void) - } - - fn end(self) -> Result<Ok, Error> { - void::unreachable(self.void) - } -} - -impl<Ok> ser::SerializeTupleVariant for VoidSerializer<Ok> { - type Ok = Ok; - type Error = Error; - - fn serialize_field<T: ?Sized + ser::Serialize>(&mut self, - _value: &T) - -> Result<(), Error> { - void::unreachable(self.void) - } - - fn end(self) -> Result<Ok, Error> { - void::unreachable(self.void) - } -} - -impl<Ok> ser::SerializeMap for VoidSerializer<Ok> { - type Ok = Ok; - type Error = Error; - - fn serialize_key<T: ?Sized + ser::Serialize>(&mut self, - _key: &T) - -> Result<(), Error> { - void::unreachable(self.void) - } - - fn serialize_value<T: ?Sized + ser::Serialize>(&mut self, - _value: &T) - -> Result<(), Error> { - void::unreachable(self.void) - } - - fn end(self) -> Result<Ok, Error> { - void::unreachable(self.void) - } -} - -impl<Ok> ser::SerializeStruct for VoidSerializer<Ok> { - type Ok = Ok; - type Error = Error; - - fn serialize_field<T: ?Sized + ser::Serialize>(&mut self, - _key: &'static str, - _value: &T) - -> Result<(), Error> { - void::unreachable(self.void) - } - - fn end(self) -> Result<Ok, Error> { - void::unreachable(self.void) - } -} - -impl<Ok> ser::SerializeStructVariant for VoidSerializer<Ok> { - type Ok = Ok; - type Error = Error; - - fn serialize_field<T: ?Sized + ser::Serialize>(&mut self, - _key: &'static str, - _value: &T) - -> Result<(), Error> { - void::unreachable(self.void) - } - - fn end(self) -> Result<Ok, Error> { - void::unreachable(self.void) - } -} |