Function xcb::parse_display

source ·
pub fn parse_display(name: &str) -> Option<DisplayInfo>
Expand description

Parses a display string in the form documented by X (7x).

Returns Some(DisplayInfo) on success and None otherwise. Has no side effects on failure.

If name empty, it uses the environment variable DISPLAY.

If name does not contain a screen number, DisplayInfo::screen is set to 0.

§Example

use xcb::{DisplayInfo, parse_display};

assert_eq!(parse_display(":0"), Some(DisplayInfo {
    host: "".to_string(),
    display: 0,
    screen: 0,
}));
assert_eq!(parse_display("localhost:0.1"), Some(DisplayInfo {
    host: "localhost".to_string(),
    display: 0,
    screen: 1,
}));

assert!(parse_display("0").is_none());