Struct rxscreen::Display [−][src]
Fields
width: u32
height: u32
Implementations
impl Display
[src]
pub fn new(
display_identifier: impl Into<String>
) -> Result<Self, DisplayCreationError>
[src]
display_identifier: impl Into<String>
) -> Result<Self, DisplayCreationError>
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,