Hi, I'm working on a project and I've run into a problem.
I have a struct with two fields: a referenced Array<T> storing a reference to input, and another Array<T> that stores output.
struct RandomStruct<'a, T: HasAfEnum> {inputs: LazyCell<&'a Array<T>>, outputs: Array<T>}
It has a method implemented that modifies both fields and stores them in.
impl<'a, T: HasAfEnum> RandomStruct<'a, T> {
pub fn modify_and_store_inputs_and_outputs(&mut self, x: &'a Array<T>) {
self.inputs.fill(x).ok();
self.outputs = x * x;
}
} ```
After defining "a", "b", and "inputs", I want to borrow the outputs stored in "a" and store that reference in "b.inputs", (neither fields will be modified more then once per loop).
```rust
fn main() {
let mut a: RandomStruct<f32> = RandomStruct::default();
let mut b: RandomStruct<f32> = RandomStruct::default();
let inputs: Array<f32> = randn(dim4!(5, 5));
for i in 0..100 {
a.modify_and_store_inputs_and_outputs(&inputs);
b.modify_and_store_inputs_and_outputs(&a.outputs);
}
}
This however the compiler doesn't like, and I'm lost on how to resolve it.