how to share this test data accross hyper.
for example:
strcut Router { name:String, data:HashMap}
let mut c_router = Router::new();
let s2 = Arc::new(c_router);
let make_svc = make_service_fn(|| async {
Ok::<, GenericError>(service_fn(|req| handle_url(s2.clone(), req)))
});
let server = Server::bind(&addr).serve(make_svc);
if i use Arc::clone, then it will shows clone dont live long enough as lifetime issues.
the example from hyper is only share a usize data, which impl copy, it is easy to share.
but how to share things like this?
my conclusion is that dont mislead by the cargo check info , the problem it infers maybe not the key problem. you need to try to analyze the key problem by your self.
If you paste my example into the playground like this, it compiles as-is with no changes. You can try cargo clean if you think it is a cache issue, but I don't think that is usually the case.
Perhaps you only copied some of my code and left the rest to be your own code, which left out some important detail from my example?
yeah, maybe.
i think i'm mislead by the cargo check info.
struggling fight for lifetime issue, but actually is the usage problem.
i will check more info.
thanks a lot