From c500d56d4d67376bfc66d5ac921a7e35995b3984 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Thu, 22 Jul 2021 21:33:09 -0700 Subject: [PATCH] lights: make intensity parameter generic. --- rtchallenge/src/lights.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rtchallenge/src/lights.rs b/rtchallenge/src/lights.rs index b023565..b34f3d9 100644 --- a/rtchallenge/src/lights.rs +++ b/rtchallenge/src/lights.rs @@ -28,10 +28,13 @@ impl PointLight { /// assert_eq!(light.position, position); /// assert_eq!(light.intensity, intensity); /// ``` - pub fn new(position: Tuple, intensity: Color) -> PointLight { + pub fn new(position: Tuple, intensity: C) -> PointLight + where + C: Into, + { PointLight { position, - intensity, + intensity: intensity.into(), } } }