[docs] devtools example errors in v2
gronke opened this issue · comments
Stefan Grönke commented
Documented on: https://beta.tauri.app/guides/debug/application/#opening-devtools-programmatically
lib.rs
use tauri::Manager;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.setup(|app| {
#[cfg(debug_assertions)] // only include this code on debug builds
{
let window = app.get_window("main").unwrap();
window.open_devtools();
window.close_devtools();
}
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
% cargo tauri dev
...
warning: unused import: `tauri::Manager`
--> src/lib.rs:1:5
|
1 | use tauri::Manager;
| ^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
error[E0599]: no method named `get_window` found for mutable reference `&mut tauri::App` in the current scope
--> src/lib.rs:9:26
|
9 | let window = app.get_window("main").unwrap();
| ^^^^^^^^^^ method not found in `&mut App`
For more information about this error, try `rustc --explain E0599`.
warning: `app` (lib) generated 1 warning
error: could not compile `app` (lib) due to 1 previous error; 1 warning emitted
Vitor Ayres commented
thanks for reporting @gronke, should be solved with the mentioned PR.