diff --git a/src/api/mod.rs b/src/api/mod.rs index 8af4625..d6fb6a7 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -122,3 +122,29 @@ pub trait PgWireHandlerFactory { fn copy_handler(&self) -> Arc; } + +impl PgWireHandlerFactory for Arc +where + T: PgWireHandlerFactory, +{ + type StartupHandler = T::StartupHandler; + type SimpleQueryHandler = T::SimpleQueryHandler; + type ExtendedQueryHandler = T::ExtendedQueryHandler; + type CopyHandler = T::CopyHandler; + + fn simple_query_handler(&self) -> Arc { + (**self).simple_query_handler() + } + + fn extended_query_handler(&self) -> Arc { + (**self).extended_query_handler() + } + + fn startup_handler(&self) -> Arc { + (**self).startup_handler() + } + + fn copy_handler(&self) -> Arc { + (**self).copy_handler() + } +} diff --git a/src/tokio.rs b/src/tokio.rs index 6e7b533..0733139 100644 --- a/src/tokio.rs +++ b/src/tokio.rs @@ -359,7 +359,7 @@ fn check_alpn_for_direct_ssl(tls_socket: &TlsStream) -> Result<(), IOErr pub async fn process_socket( tcp_socket: TcpStream, tls_acceptor: Option>, - handlers: Arc, + handlers: H, ) -> Result<(), IOError> where H: PgWireHandlerFactory,