Skip to content

Instantly share code, notes, and snippets.

@mcr
Created November 19, 2020 09:18
Show Gist options
  • Save mcr/b598db46b4851f32e09a541db9188f09 to your computer and use it in GitHub Desktop.
Save mcr/b598db46b4851f32e09a541db9188f09 to your computer and use it in GitHub Desktop.
fn main () -> Result<(), String> {
let mut rt = tokio::runtime::Builder::new()
.basic_scheduler()
.build().unwrap();
let future = do_it(&rt);
println!("blocking in main");
rt.block_on(future).unwrap();
return Ok(());
}
okay, back to:
obiwan-[connect/netlink/rtnetlink](2.6.6) mcr 18321 %cargo build --example get_links0
Compiling rtnetlink v0.5.0 (/ssw/projects/pandora/connect/netlink/rtnetlink)
error[E0502]: cannot borrow `rt` as mutable because it is also borrowed as immutable
--> rtnetlink/examples/get_links0.rs:123:5
|
121 | let future = do_it(&rt);
| --- immutable borrow occurs here
122 | println!("blocking in main");
123 | rt.block_on(future).unwrap();
| ^^^--------^^^^^^^^
| | |
| | immutable borrow later used by call
| mutable borrow occurs here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment