-
Hello everyone, I'm new to rust and slint and I was asked to help on a project and currently i'm trying to get the ssid of a network to kind of be a global one, so as you can see below this is the slint part in rust that gets the ssid and password:
and i tried doing this:
but rust won't let me, so I was wondering if I could get this value in any other way |
Beta Was this translation helpful? Give feedback.
Answered by
ogoffart
Jan 5, 2024
Replies: 1 comment
-
Maybe wrap your global data in a example: let ssid = Rc::new(RefCell::new(String::new());
ui.on_wifi_try({
let ssid = ssid.clone();
move |local_wi_name, local_wi_pass| {
let _ui = set_wifi_data.upgrade().unwrap();
connect_wifi(&local_wi_name, &local_wi_pass);
*ssid.borrow_mut() = local_wi_name.to_string();
_ui.set_wifi_status_0(wifi_data.status.into());
}
});
println!("{}", ssid.borrow().as_str()); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Rfellipe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe wrap your global data in a
Rc<RefCell>
example: