MCPcopy Create free account
hub / github.com/algoscienceacademy/RustUI / new_with_platform

Method new_with_platform

src/window.rs:55–82  ·  view source on GitHub ↗
(platform: &str)

Source from the content-addressed store, hash-verified

53 }
54
55 pub fn new_with_platform(platform: &str) -> Self {
56 let platform = match platform {
57 "desktop" => PlatformWindow::Desktop(DesktopWindow {
58 min_size: Size::new(300.0, 200.0),
59 max_size: Size::new(f32::MAX, f32::MAX),
60 resizable: true,
61 }),
62 "ios" | "android" => PlatformWindow::Mobile(MobileWindow {
63 safe_area: SafeArea::default(),
64 orientation: Orientation::Portrait,
65 }),
66 "web" => PlatformWindow::Web(WebWindow {
67 container_id: "rust-ui-app".to_string(),
68 }),
69 _ => PlatformWindow::Desktop(DesktopWindow {
70 min_size: Size::new(300.0, 200.0),
71 max_size: Size::new(f32::MAX, f32::MAX),
72 resizable: true,
73 }),
74 };
75
76 Self {
77 width: 800,
78 height: 600,
79 scale_factor: 1.0,
80 platform,
81 }
82 }
83
84 pub fn resize(&mut self, width: u32, height: u32) {
85 self.width = width;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected