Fair new to Rust, i'm having a problem that I just can't understand how to fix..
I have the following code:
let mut Response = Http::Response::new(stream); let true_response = func(Request, &Response); Response.write_response(&true_response);
That throws the following error (trimmed for easier reabability):
error[E0502]: cannot borrow `Response` as mutable because it is also borrowed as immutable let mut true_response = func(Request, &Response); --------- immutable borrow occurs here Response.write_response(&true_response); ^^^^^^^^^----------------------^^^^^^^^^^^^^^^^ | | | | immutable borrow later used by call | mutable borrow occurs here
Can anyone tell what I may be doing wrong?