pub struct SceneHandle(/* private fields */);Expand description
A value conforming to SwiftUI’s Scene — a window, a settings pane, a
menu-bar item, or a tuple of them.
Implementations§
Source§impl SceneHandle
impl SceneHandle
Sourcepub fn type_name(&self) -> String
pub fn type_name(&self) -> String
The Swift type of the scene, as the runtime spells it.
Examples found in repository?
examples/scenes.rs (line 291)
282fn main() {
283 // `--describe` asks the same question the event loop would and prints the
284 // answer: what Swift types came out of this. Useful because the types are
285 // the claim — `_TupleScene<(WindowGroup<AnyView>, Settings<AnyView>, …)>` is
286 // what Swift builds from four scenes in a row, and nothing about a window
287 // appearing would say whether that is what got built.
288 #[cfg(target_os = "macos")]
289 if std::env::args().any(|a| a == "--describe") {
290 let whole = body();
291 println!("App.Body\n {}", whole.type_name());
292 for (name, s) in [
293 ("window_group", scene::window_group(main_window)),
294 ("settings", scene::settings(settings_pane)),
295 ("window", scene::window("Utility", "utility", utility_window)),
296 ("menu_bar_extra", scene::menu_bar_extra("Count", "star.fill", menu_bar_item)),
297 ] {
298 println!("{name}\n {}", s.type_name());
299 }
300 // Built through the macro, so this also checks that what `scenes!`
301 // expands to is the same thing the free functions build.
302 let one = scenes! { window_group { text("x") } commands { menu("M") { text("x") } } };
303 println!("scenes! with one menu\n {}", one.type_name());
304 return;
305 }
306
307 // `--probe` launches for real and reports what AppKit built, then quits.
308 #[cfg(target_os = "macos")]
309 if std::env::args().any(|a| a == "--probe") {
310 probe::schedule(2.5);
311 }
312
313 app::run_scene(body)
314}Auto Trait Implementations§
impl !Send for SceneHandle
impl !Sync for SceneHandle
impl Freeze for SceneHandle
impl RefUnwindSafe for SceneHandle
impl Unpin for SceneHandle
impl UnsafeUnpin for SceneHandle
impl UnwindSafe for SceneHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more