Browse Source

Simplify symbols bounds a bit

master
Adrian Heine 2 years ago
parent
commit
e3b425eb1c
  1. 4
      src/symbols/mariadb/database.rs
  2. 4
      src/symbols/mariadb/dump.rs
  3. 4
      src/symbols/mariadb/user.rs
  4. 4
      src/symbols/npm.rs
  5. 8
      src/symbols/postgresql/database.rs
  6. 2
      src/symbols/wordpress/plugin.rs
  7. 2
      src/symbols/wordpress/translation.rs

4
src/symbols/mariadb/database.rs

@ -11,7 +11,7 @@ pub struct Database<'a, D, S, C> {
command_runner: &'a 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 { pub const fn new(db_name: D, seed_file: S, command_runner: &'a C) -> Self {
Self { Self {
db_name, db_name,
@ -19,7 +19,9 @@ impl<'a, D, S, C: CommandRunner> Database<'a, D, S, C> {
command_runner, command_runner,
} }
} }
}
impl<'a, D, S, C: CommandRunner> Database<'a, D, S, C> {
async fn run_sql(&self, sql: &str) -> Result<String, Box<dyn Error>> { async fn run_sql(&self, sql: &str) -> Result<String, Box<dyn Error>> {
let b = self let b = self
.command_runner .command_runner

4
src/symbols/mariadb/dump.rs

@ -12,7 +12,7 @@ pub struct Dump<'a, N, C, S> {
command_runner: &'a C, 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 { pub const fn new(db_name: N, storage: S, command_runner: &'a C) -> Self {
Self { Self {
db_name, db_name,
@ -20,7 +20,9 @@ impl<'a, N, C: CommandRunner, S> Dump<'a, N, C, S> {
command_runner, command_runner,
} }
} }
}
impl<'a, N, C: CommandRunner, S> Dump<'a, N, C, S> {
async fn run_sql(&self, sql: &str) -> Result<String, Box<dyn Error>> { async fn run_sql(&self, sql: &str) -> Result<String, Box<dyn Error>> {
let b = self let b = self
.command_runner .command_runner

4
src/symbols/mariadb/user.rs

@ -9,14 +9,16 @@ pub struct User<'a, U, C> {
command_runner: &'a C, command_runner: &'a C,
} }
impl<'a, U: AsRef<str>, C: CommandRunner> User<'a, U, C> {
impl<'a, U: AsRef<str>, C> User<'a, U, C> {
pub const fn new(user_name: U, command_runner: &'a C) -> Self { pub const fn new(user_name: U, command_runner: &'a C) -> Self {
Self { Self {
user_name, user_name,
command_runner, command_runner,
} }
} }
}
impl<'a, U: AsRef<str>, C: CommandRunner> User<'a, U, C> {
async fn run_sql(&self, sql: &str) -> Result<String, Box<dyn Error>> { async fn run_sql(&self, sql: &str) -> Result<String, Box<dyn Error>> {
let b = self let b = self
.command_runner .command_runner

4
src/symbols/npm.rs

@ -6,12 +6,12 @@ use std::fmt;
use std::path::Path; use std::path::Path;
#[derive(Debug)] #[derive(Debug)]
pub struct Install<'a, T: AsRef<Path>, C: CommandRunner> {
pub struct Install<'a, T: AsRef<Path>, C> {
target: T, target: T,
command_runner: &'a C, command_runner: &'a C,
} }
impl<'a, T: AsRef<Path>, C: CommandRunner> Install<'a, T, C> {
impl<'a, T: AsRef<Path>, C> Install<'a, T, C> {
pub const fn new(target: T, command_runner: &'a C) -> Self { pub const fn new(target: T, command_runner: &'a C) -> Self {
Self { Self {
target, target,

8
src/symbols/postgresql/database.rs

@ -5,21 +5,23 @@ use std::error::Error;
use std::fmt; use std::fmt;
#[derive(Debug)] #[derive(Debug)]
pub struct PostgreSQLDatabase<'a, N: AsRef<str>, S: AsRef<str>, C: CommandRunner> {
pub struct PostgreSQLDatabase<'a, N, S, C> {
name: N, name: N,
seed_file: S, seed_file: S,
command_runner: &'a C, command_runner: &'a C,
} }
impl<'a, N: AsRef<str>, S: AsRef<str>, 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 { pub const fn new(name: N, seed_file: S, command_runner: &'a C) -> Self {
PostgreSQLDatabase {
Self {
name, name,
seed_file, seed_file,
command_runner, command_runner,
} }
} }
}
impl<'a, N: AsRef<str>, S: AsRef<str>, C: CommandRunner> PostgreSQLDatabase<'a, N, S, C> {
async fn run_sql(&self, sql: &str) -> Result<String, Box<dyn Error>> { async fn run_sql(&self, sql: &str) -> Result<String, Box<dyn Error>> {
let b = self let b = self
.command_runner .command_runner

2
src/symbols/wordpress/plugin.rs

@ -15,7 +15,7 @@ pub struct Plugin<'a, P, N, R> {
command_runner: &'a R, command_runner: &'a R,
} }
impl<'a, P: AsRef<Path>, N: AsRef<str>, R: CommandRunner> Plugin<'a, P, N, R> {
impl<'a, P: AsRef<Path>, N: AsRef<str>, R> Plugin<'a, P, N, R> {
pub const fn new(base: P, name: N, command_runner: &'a R) -> Self { pub const fn new(base: P, name: N, command_runner: &'a R) -> Self {
Self { Self {
base, base,

2
src/symbols/wordpress/translation.rs

@ -18,7 +18,7 @@ pub struct Translation<'a, C, D, R> {
command_runner: &'a R, command_runner: &'a R,
} }
impl<'a, D, C: AsRef<str>, R: CommandRunner> Translation<'a, C, D, R> {
impl<'a, D, C: AsRef<str>, R> Translation<'a, C, D, R> {
pub const fn new(path: D, version: &'a str, locale: C, command_runner: &'a R) -> Self { pub const fn new(path: D, version: &'a str, locale: C, command_runner: &'a R) -> Self {
Self { Self {
path, path,

Loading…
Cancel
Save