Skip to main content

PlatformDisplay

Trait PlatformDisplay 

Source
pub trait PlatformDisplay: Debug {
    // Required methods
    fn id(&self) -> DisplayId;
    fn uuid(&self) -> Result<Uuid>;
    fn bounds(&self) -> Bounds<Pixels>;
    fn refresh_interval(&self) -> Option<Duration>;

    // Provided methods
    fn visible_bounds(&self) -> Bounds<Pixels> { ... }
    fn default_bounds(&self) -> Bounds<Pixels> { ... }
}
Expand description

A display, such as a monitor or a laptop screen, as the platform reports it.

Obtain one from App::displays or App::primary_display. Its bounds are in logical pixels.

Required Methods§

Source

fn id(&self) -> DisplayId

Returns the display’s id for the current session. To persist a display across restarts, use PlatformDisplay::uuid.

Source

fn uuid(&self) -> Result<Uuid>

Returns a stable identifier for this display that survives restarts.

Returns an error if the platform can’t provide one.

Source

fn bounds(&self) -> Bounds<Pixels>

Returns the display’s full bounds in logical pixels, including areas such as the taskbar.

Source

fn refresh_interval(&self) -> Option<Duration>

The time between the display’s refreshes. Variable refresh rate displays report their maximum rate. None when the platform doesn’t report it.

May query the operating system; GPUI caches it per display, see Window::refresh_interval.

Provided Methods§

Source

fn visible_bounds(&self) -> Bounds<Pixels>

Returns the usable bounds, excluding the menu bar, Dock and taskbar.

Defaults to PlatformDisplay::bounds when a backend doesn’t override it.

Source

fn default_bounds(&self) -> Bounds<Pixels>

Returns the bounds a new window opens at on this display: the default window size, centered and clipped to the display.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§