-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
(Sorry for the not-super-minimized rerpo, I ran into this while following the gfx-hal intro.)
Cargo.toml
[package]
name = "gfx-hal-tutorials"
version = "0.0.0"
edition = "2018"
publish = false
[dependencies]
winit = "0.22.0"main.rs (use at root scope)
use winit::dpi::{LogicalSize, PhysicalSize};
const WINDOW_SIZE: [u32; 2] = [512, 512];
fn main() {
let event_loop = winit::event_loop::EventLoop::new();
let (logical_window_size, physical_window_size) = {
let dpi = event_loop.primary_monitor().scale_factor();
let logical: LogicalSize<u32> = WINDOW_SIZE.into();
let physical: PhysicalSize<u32> = logical.to_physical(dpi);
(logical, physical)
};
}main.rs (scoped use)
const WINDOW_SIZE: [u32; 2] = [512, 512];
fn main() {
use winit::dpi::{LogicalSize, PhysicalSize};
let event_loop = winit::event_loop::EventLoop::new();
let (logical_window_size, physical_window_size) = {
let dpi = event_loop.primary_monitor().scale_factor();
let logical: LogicalSize<u32> = WINDOW_SIZE.into();
let physical: PhysicalSize<u32> = logical.to_physical(dpi);
(logical, physical)
};
}This second form infers the wrong type for logical_window_size, and no type for physical_window_size.
Metadata
Metadata
Assignees
Labels
No labels

