From e86ba5f7d30045e25bc94eb62586df1dbee28f7f 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 ed8e327f..2ec6c12e 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.