Struct rxscreen::Display[][src]

pub struct Display {
    pub width: u32,
    pub height: u32,
    // some fields omitted
}

Fields

width: u32height: u32

Implementations

impl Display[src]

pub fn new(
    display_identifier: impl Into<String>
) -> Result<Self, DisplayCreationError>
[src]

Open a display to X server using XOpenDisplay at specified display domain

if let Ok(display) = Display::new(":0.0") {
	// do something with display
}

Errors

If the call to XOpenDisplay fails, or if display_identifier couldn’t be converted to a C String, then this function will return a DisplayCreationError with details

pub fn screenshot(&self) -> Result<Image, ()>[src]

Take a screenshot of the display.

if let Ok(display) = Display::new(":0.0") {
	let screenshot = display.screenshot();
	#[cfg(feature = "save")]
	// With "save" feature enabled
	screenshot.unwrap().save_as("./screenshot.png");
	#[cfg(not(feature = "save"))]
	// Access to raw image data without "save" feature
	let raw_data = unsafe { screenshot.unwrap().as_raw_slice() };
}

Errors

This function fails silently if the call to XGetImage fails for some reason.

Trait Implementations

impl Drop for Display[src]

Auto Trait Implementations

impl RefUnwindSafe for Display

impl !Send for Display

impl !Sync for Display

impl Unpin for Display

impl UnwindSafe for Display

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.