From 8e4588fc1b1459f9b41ad6b2fbc4401bb49a2439 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Wed, 15 Feb 2023 21:09:35 -0800 Subject: [PATCH] Better names. --- src/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 036f7c9..562cd46 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,14 +1,14 @@ use std::collections::HashMap; trait Material {} -struct Impl1 {} -impl Material for Impl1 {} +struct MaterialImpl {} +impl Material for MaterialImpl {} trait Shape {} -struct Impl2 { +struct ShapeImpl { v: M, } -impl Shape for Impl2 where M: Material {} +impl Shape for ShapeImpl where M: Material {} impl Material for &Box {} struct State { @@ -18,10 +18,10 @@ struct State { fn load_map() -> State { let mut materials: HashMap> = HashMap::new(); - materials.insert("one".to_string(), Box::new(Impl1 {})); - materials.insert("two".to_string(), Box::new(Impl1 {})); + materials.insert("one".to_string(), Box::new(MaterialImpl {})); + materials.insert("two".to_string(), Box::new(MaterialImpl {})); - let shape = Box::new(Impl2 { + let shape = Box::new(ShapeImpl { v: materials.get("one").unwrap(), });