[−][src]Struct show_image::Window
A window capable of displaying images.
The handle can be used to set the displayed image, handle key events and to close the window.
If the handle is dropped, the window is closed.
Methods
impl Window
[src]
pub fn set_image(
&self,
image: impl ImageData,
name: impl Into<String>
) -> Result<(), String>
[src]
&self,
image: impl ImageData,
name: impl Into<String>
) -> Result<(), String>
Set the image to de displayed by the window.
The name is used to suggest a defaullt file name when saving images.
It is also returned again by Window::get_image
.
pub fn get_image(
&self
) -> Result<Option<(Arc<[u8]>, ImageInfo, String)>, String>
[src]
&self
) -> Result<Option<(Arc<[u8]>, ImageInfo, String)>, String>
Get the currently displayed image of the window.
pub fn close(self) -> Result<(), String>
[src]
Close the window.
The window is automatically closed if the handle is dropped, but this function allows you to handle errors that may occur.
pub fn events(&self) -> &Receiver<KeyboardEvent>
[src]
Get the receiver for keyboard events.
pub fn wait_key(
&self,
timeout: Duration
) -> Result<Option<KeyboardEvent>, WaitKeyError>
[src]
&self,
timeout: Duration
) -> Result<Option<KeyboardEvent>, WaitKeyError>
Wait for a key-down event with a timeout.
If an error is returned, no further key events will be received. Any loop processing keyboard input should terminate.
If no key press was available within the timeout, Ok(None)
is returned.
This function discards all key-up events and blocks until a key is pressed or the timeout occurs.
pub fn wait_key_deadline(
&self,
deadline: Instant
) -> Result<Option<KeyboardEvent>, WaitKeyError>
[src]
&self,
deadline: Instant
) -> Result<Option<KeyboardEvent>, WaitKeyError>
Wait for a key-down event with a deadline.
If an error is returned, no further key events will be received. Any loop processing keyboard input should terminate.
If no key press was available within the timeout, Ok(None)
is returned.
This function discards all key-up events and blocks until a key is pressed or the deadline passes.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Window
impl Send for Window
impl !Sync for Window
impl Unpin for Window
impl !UnwindSafe for Window
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,
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> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
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.
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>,