Better names.

This commit is contained in:
Bill Thiede 2023-02-15 21:09:35 -08:00
parent 5355b4388e
commit 8e4588fc1b

View File

@ -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<M: Material> {
struct ShapeImpl<M: Material> {
v: M,
}
impl<M> Shape for Impl2<M> where M: Material {}
impl<M> Shape for ShapeImpl<M> where M: Material {}
impl Material for &Box<dyn Material> {}
struct State {
@ -18,10 +18,10 @@ struct State {
fn load_map() -> State {
let mut materials: HashMap<String, Box<dyn Material>> = 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(),
});