From e3b425eb1c5294cc09f1e2a2ca7935f246bcc2c8 Mon Sep 17 00:00:00 2001 From: Adrian Heine Date: Thu, 9 Mar 2023 11:21:58 +0100 Subject: [PATCH] Simplify symbols bounds a bit --- src/symbols/mariadb/database.rs | 4 +++- src/symbols/mariadb/dump.rs | 4 +++- src/symbols/mariadb/user.rs | 4 +++- src/symbols/npm.rs | 4 ++-- src/symbols/postgresql/database.rs | 8 +++++--- src/symbols/wordpress/plugin.rs | 2 +- src/symbols/wordpress/translation.rs | 2 +- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/symbols/mariadb/database.rs b/src/symbols/mariadb/database.rs index 95ae693..03d3d11 100644 --- a/src/symbols/mariadb/database.rs +++ b/src/symbols/mariadb/database.rs @@ -11,7 +11,7 @@ pub struct Database<'a, D, S, C> { command_runner: &'a C, } -impl<'a, D, S, C: CommandRunner> Database<'a, D, S, C> { +impl<'a, D, S, C> Database<'a, D, S, C> { pub const fn new(db_name: D, seed_file: S, command_runner: &'a C) -> Self { Self { db_name, @@ -19,7 +19,9 @@ impl<'a, D, S, C: CommandRunner> Database<'a, D, S, C> { command_runner, } } +} +impl<'a, D, S, C: CommandRunner> Database<'a, D, S, C> { async fn run_sql(&self, sql: &str) -> Result> { let b = self .command_runner diff --git a/src/symbols/mariadb/dump.rs b/src/symbols/mariadb/dump.rs index 7503ad1..50aae92 100644 --- a/src/symbols/mariadb/dump.rs +++ b/src/symbols/mariadb/dump.rs @@ -12,7 +12,7 @@ pub struct Dump<'a, N, C, S> { command_runner: &'a C, } -impl<'a, N, C: CommandRunner, S> Dump<'a, N, C, S> { +impl<'a, N, C, S> Dump<'a, N, C, S> { pub const fn new(db_name: N, storage: S, command_runner: &'a C) -> Self { Self { db_name, @@ -20,7 +20,9 @@ impl<'a, N, C: CommandRunner, S> Dump<'a, N, C, S> { command_runner, } } +} +impl<'a, N, C: CommandRunner, S> Dump<'a, N, C, S> { async fn run_sql(&self, sql: &str) -> Result> { let b = self .command_runner diff --git a/src/symbols/mariadb/user.rs b/src/symbols/mariadb/user.rs index 9fb3730..8a09d45 100644 --- a/src/symbols/mariadb/user.rs +++ b/src/symbols/mariadb/user.rs @@ -9,14 +9,16 @@ pub struct User<'a, U, C> { command_runner: &'a C, } -impl<'a, U: AsRef, C: CommandRunner> User<'a, U, C> { +impl<'a, U: AsRef, C> User<'a, U, C> { pub const fn new(user_name: U, command_runner: &'a C) -> Self { Self { user_name, command_runner, } } +} +impl<'a, U: AsRef, C: CommandRunner> User<'a, U, C> { async fn run_sql(&self, sql: &str) -> Result> { let b = self .command_runner diff --git a/src/symbols/npm.rs b/src/symbols/npm.rs index 5275d64..d2118cf 100644 --- a/src/symbols/npm.rs +++ b/src/symbols/npm.rs @@ -6,12 +6,12 @@ use std::fmt; use std::path::Path; #[derive(Debug)] -pub struct Install<'a, T: AsRef, C: CommandRunner> { +pub struct Install<'a, T: AsRef, C> { target: T, command_runner: &'a C, } -impl<'a, T: AsRef, C: CommandRunner> Install<'a, T, C> { +impl<'a, T: AsRef, C> Install<'a, T, C> { pub const fn new(target: T, command_runner: &'a C) -> Self { Self { target, diff --git a/src/symbols/postgresql/database.rs b/src/symbols/postgresql/database.rs index 3b825fd..f815e55 100644 --- a/src/symbols/postgresql/database.rs +++ b/src/symbols/postgresql/database.rs @@ -5,21 +5,23 @@ use std::error::Error; use std::fmt; #[derive(Debug)] -pub struct PostgreSQLDatabase<'a, N: AsRef, S: AsRef, C: CommandRunner> { +pub struct PostgreSQLDatabase<'a, N, S, C> { name: N, seed_file: S, command_runner: &'a C, } -impl<'a, N: AsRef, S: AsRef, C: CommandRunner> PostgreSQLDatabase<'a, N, S, C> { +impl<'a, N, S, C> PostgreSQLDatabase<'a, N, S, C> { pub const fn new(name: N, seed_file: S, command_runner: &'a C) -> Self { - PostgreSQLDatabase { + Self { name, seed_file, command_runner, } } +} +impl<'a, N: AsRef, S: AsRef, C: CommandRunner> PostgreSQLDatabase<'a, N, S, C> { async fn run_sql(&self, sql: &str) -> Result> { let b = self .command_runner diff --git a/src/symbols/wordpress/plugin.rs b/src/symbols/wordpress/plugin.rs index 6ac40e2..63f823a 100644 --- a/src/symbols/wordpress/plugin.rs +++ b/src/symbols/wordpress/plugin.rs @@ -15,7 +15,7 @@ pub struct Plugin<'a, P, N, R> { command_runner: &'a R, } -impl<'a, P: AsRef, N: AsRef, R: CommandRunner> Plugin<'a, P, N, R> { +impl<'a, P: AsRef, N: AsRef, R> Plugin<'a, P, N, R> { pub const fn new(base: P, name: N, command_runner: &'a R) -> Self { Self { base, diff --git a/src/symbols/wordpress/translation.rs b/src/symbols/wordpress/translation.rs index ac16ec3..0a41dac 100644 --- a/src/symbols/wordpress/translation.rs +++ b/src/symbols/wordpress/translation.rs @@ -18,7 +18,7 @@ pub struct Translation<'a, C, D, R> { command_runner: &'a R, } -impl<'a, D, C: AsRef, R: CommandRunner> Translation<'a, C, D, R> { +impl<'a, D, C: AsRef, R> Translation<'a, C, D, R> { pub const fn new(path: D, version: &'a str, locale: C, command_runner: &'a R) -> Self { Self { path,