Hi Rustaceans,
my first question is which these two types? Either I'm blind or rustic hiding something from me. If it says two which type is the second?
error[E0623]: lifetime mismatch
--> src/renderer/src/lib.rs:57:14
|
48 | fn ray_color(ray: &Ray, world: &World, depth: u32, rng: &mut rand::rngs::SmallRng) -> Color {
| ------
| |
| these two types are declared with different lifetimes...
...
57 | if world.hit(ray, 0.001, f32::INFINITY, &mut rec) {
| ^^^ ...but data from `world` flows into `world` here
Ok I found the source of issue. I shouldn't put a lifetime on the Hittable and World structs, instead the 'obj lifetime should go to the function definition: