How to reuse ws_to_stdout after it has been moved?

Hi, I'm still trying to figure out the most basic patterns in rust when confronted with moving values.

This example here (line 39) has a value ws_to_stdout. In my codebase it is similar, but the value is moved into tokio::join!(ws_to_stdout, ...)

I want to asynchronously be able to access ws_to_stdout to close the connection at any time

.close(Some(CloseFrame { code: CloseCode::Normal, reason: String::from("").into() })).await;

this is not possible, because the value is moved and inside something that is called a Pin.
It seems that you can acces a value that is inside a Pin, but not if its moved.

What is a common pattern and what are antipatterns to solve this?
Why can't I send a reference to the join macro?

This is my implementation

    pin!(rx, ws_to_stdout);

    let (a, b, c) = tokio::join!(async {

        loop {

            let x = rx.recv().await;

                 dbg!(&x);  // this just logs from the websocket stream

    }, ws_to_stdout, async {

        tokio::time::timeout(Duration::from_secs(5), async {

            ws_to_stdout // move error occurs here

            // let x = ws_to_stdout.as_mut();

            // ?????????????.close(Some(CloseFrame { code: CloseCode::Normal, reason: String::from("").into() })).await.unwrap();


Some meta remarks that don't directly answer your question but I think are important enough to mention.

  1. If you are learning the basics of Rust I recommend not trying to build async programs to begin with.
  2. Please format the code you are posting here.