[][src]Struct crossterm_winapi::Handle

#[repr(transparent)]
pub struct Handle { /* fields omitted */ }

This abstracts away some WinaApi calls to set and get some console handles.

Methods

impl Handle[src]

pub fn new(handle: HandleType) -> Result<Handle>[src]

pub unsafe fn from_raw(handle: HANDLE) -> Self[src]

Construct a handle from a raw handle.

Safety

This is unsafe since there is not guarantee that the underlying HANDLE is thread-safe to implement Send and Sync. Most HANDLE's however, are thread safe.

pub fn current_out_handle() -> Result<Handle>[src]

Get the handle of the active screen buffer. When using multiple screen buffers this will always point to the to the current screen output buffer.

On success this function returns the HANDLE to STD_OUTPUT_HANDLE.

This function uses CONOUT$ to create a file handle to the current output buffer.

Wraps the underlying function call: CreateFileW link: [https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-createfilew]

pub fn current_in_handle() -> Result<Handle>[src]

Get the handle of the active input screen buffer. When using multiple screen buffers this will always point to the to the current screen input buffer.

On success this function returns the HANDLE to STD_INPUT_HANDLE.

This function uses CONIN$ to create a file handle to the current input buffer.

Wraps the underlying function call: CreateFileW link: [https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-createfilew]

pub fn output_handle() -> Result<Handle>[src]

Get the handle of the output screen buffer.

On success this function returns the HANDLE to STD_OUTPUT_HANDLE.

Wraps the underlying function call: GetStdHandle whit argument STD_OUTPUT_HANDLE link: [https://docs.microsoft.com/en-us/windows/console/getstdhandle]

pub fn input_handle() -> Result<Handle>[src]

Get the handle of the input screen buffer.

On success this function returns the HANDLE to STD_INPUT_HANDLE.

Wraps the underlying function call: GetStdHandle whit argument STD_INPUT_HANDLE link: [https://docs.microsoft.com/en-us/windows/console/getstdhandle]

pub fn is_valid_handle(handle: &HANDLE) -> bool[src]

Checks if the console handle is an invalid handle value.

This is done by checking if the passed HANDLE is equal to INVALID_HANDLE_VALUE

Trait Implementations

impl Send for Handle[src]

impl Sync for Handle[src]

impl From<Handle> for Console[src]

fn from(handle: Handle) -> Self[src]

Create a Console instance who's functions will be executed on the the given Handle

impl From<Handle> for ConsoleMode[src]

impl From<Handle> for ScreenBuffer[src]

impl Clone for Handle[src]

impl Deref for Handle[src]

type Target = HANDLE

The resulting type after dereferencing.

Auto Trait Implementations

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

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

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

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