1- use std:: collections:: BTreeMap ;
1+ use std:: { collections:: BTreeMap , ops :: Deref } ;
22
33use schemars:: JsonSchema ;
44use serde:: { Deserialize , Serialize } ;
@@ -26,8 +26,10 @@ enum DummyJdbcConnection {
2626 Generic ( GenericJdbcDatabaseConnection ) ,
2727}
2828
29- impl DummyJdbcConnection {
30- fn as_jdbc_database_connection ( & self ) -> & dyn JdbcDatabaseConnection {
29+ impl Deref for DummyJdbcConnection {
30+ type Target = dyn JdbcDatabaseConnection ;
31+
32+ fn deref ( & self ) -> & Self :: Target {
3133 match self {
3234 Self :: Postgresql ( p) => p,
3335 Self :: Generic ( g) => g,
@@ -44,8 +46,10 @@ enum DummyCeleryConnection {
4446 Generic ( GenericCeleryDatabaseConnection ) ,
4547}
4648
47- impl DummyCeleryConnection {
48- fn as_celery_database_connection ( & self ) -> & dyn CeleryDatabaseConnection {
49+ impl Deref for DummyCeleryConnection {
50+ type Target = dyn CeleryDatabaseConnection ;
51+
52+ fn deref ( & self ) -> & Self :: Target {
4953 match self {
5054 Self :: Postgresql ( p) => p,
5155 Self :: Redis ( r) => r,
@@ -66,7 +70,6 @@ fn test_dummy_jdbc_database_usage() {
6670 } ) ;
6771 // Apply actual config
6872 let jdbc_connection_details = dummy_jdbc_connection
69- . as_jdbc_database_connection ( )
7073 . jdbc_connection_details ( "persistence" )
7174 . unwrap ( ) ;
7275 let mut container_builder = ContainerBuilder :: new ( "my-container" ) . unwrap ( ) ;
@@ -100,7 +103,6 @@ fn test_dummy_celery_database_usage() {
100103 } ) ;
101104 // Apply actual config
102105 let celery_connection_details = dummy_celery_connection
103- . as_celery_database_connection ( )
104106 . celery_connection_details_with_templating (
105107 "worker_queue" ,
106108 & TemplatingMechanism :: BashEnvSubstitution ,
0 commit comments