title: Unable to change pathBuff/path variable in async function
body: <p>I was unsure if I should post this here or in code review.
  Code review seems to have only functioning code.</p>
  <p>So I've a multitude of problems I don't really understand.
  (I’m a noob) full code can be found here: <a href="https://github.com/NicTanghe/winder/blob/main/src/main.rs" rel="nofollow noreferrer">https://github.com/NicTanghe/winder/blob/main/src/main.rs</a>
  main problem is here:</p>
  <pre class="lang-rust prettyprint-override"><code>let temp = location_loc1.parent().unwrap();
  location_loc1.push(&amp;temp);
  </code></pre>
  <p>I’ve tried various things to get around problems with borrowing as mutable or as reference,
  and I can’t seem to get it to work.</p>
  <p>I just get a different set of errors with everything I try.
  Furthermore, I'm sorry if this is a duplicate, but looking for separate solutions to the errors just gave me a different error. In a circle.</p>
  <p>Full function</p>
  <pre><code>async fn print_events(mut selector_loc1:i8, location_loc1: PathBuf) {
      let mut reader = EventStream::new();
  
      loop {
          //let delay = Delay::new(Duration::from_millis(1_000)).fuse();
          let mut event = reader.next().fuse();
  
          select! {
              // _ = delay =&gt; {
              //      print!(&quot;{esc}[2J{esc}[1;1H{}&quot;, esc = 27 as char,); 
                   
              // },
              maybe_event = event =&gt; {
                  match maybe_event {
                      Some(Ok(event)) =&gt; {
                          //println!(&quot;Event::{:?}\r&quot;, event);
                          
                          // if event == Event::Mouse(MouseEvent::Up(&quot;Left&quot;).into()) {
                          //     println!(&quot;Cursor position: {:?}\r&quot;, position());
                          // }   
                          print!(&quot;{esc}[2J{esc}[1;1H{}&quot;, esc = 27 as char,); 
                          if event == Event::Key(KeyCode::Char('k').into()) {
                              if selector_loc1 &gt; 0 {
                                  selector_loc1 -= 1;
                              };
                              //println!(&quot;go down&quot;);
                              //println!(&quot;{}&quot;,selected)
  
                          }   else if event == Event::Key(KeyCode::Char('j').into()) {
                              selector_loc1 += 1;
                              //println!(&quot;go up&quot;);
                              //println!(&quot;{}&quot;,selected)
                          }   else if event == Event::Key(KeyCode::Char('h').into()) {
  
  
                          //-----------------------------------------
                          //-------------BackLogic-------------------
                          //-----------------------------------------
                              let temp = location_loc1.parent().unwrap();
                              location_loc1.push(&amp;temp);
                              
                          //------------------------------------------
                          //------------------------------------------
  
                          }   else if event == Event::Key(KeyCode::Char('l').into()) {
                              //go to next dir
  
                          }   if event == Event::Key(KeyCode::Esc.into()) {
                              break;
                          }
  
                          printtype(location_loc1,selector_loc1);
  
                      }
                      Some(Err(e)) =&gt; println!(&quot;Error: {:?}\r&quot;, e),
                      None =&gt; break,
                  }
              }
          };
      }
  }
  </code></pre>
  <p>also, it seems using</p>
  <pre><code>use async_std::path::{Path, PathBuf};
  </code></pre>
  <p>makes the rust not recognize unwrap() function → how would I use using ?</p>