From e2d8742743e00220046ca2a6f1c32c97a096b83e Mon Sep 17 00:00:00 2001 From: jean-airoldie <25088801+jean-airoldie@users.noreply.github.com> Date: Tue, 5 Nov 2019 20:24:50 -0500 Subject: [PATCH] Add contraints to {Serializer,Deserializer}Acceptor This allows the user to retreive concrete types from the serializer & deserializer output. --- src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 594b69d..cf7107b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -51,7 +51,9 @@ pub trait DeserializerAcceptor<'a> { /// The return type for the accept method type Output; /// Accept a serde::Deserializer and do whatever you want with it. - fn accept>(self, T) -> Self::Output; + fn accept(self, T) -> Self::Output + where + T: serde::Deserializer<'a, Error = Error>; } /// An object that implements this trait can be passed a @@ -63,7 +65,9 @@ pub trait SerializerAcceptor { /// The return type for the accept method type Output; /// Accept a serde::Serializer and do whatever you want with it. - fn accept(self, T) -> Self::Output; + fn accept(self, T) -> Self::Output + where + T: serde::Serializer; } /// Get a default configuration object.