Struct crossterm_winapi::Handle [−][src]
pub struct Handle { /* fields omitted */ }
This abstracts away some WinAPI calls to set and get some console handles.
It wraps WinAPI’s HANDLE
type.
Implementations
impl Handle
[src]
impl Handle
[src]pub fn new(handle: HandleType) -> Result<Handle>
[src]
pub fn new(handle: HandleType) -> Result<Handle>
[src]Create a new handle of a certaint type.
pub unsafe fn from_raw(handle: HANDLE) -> Self
[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]
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.
This function uses CONOUT$
to create a file handle to the current output buffer.
This wraps
CreateFileW
.
pub fn current_in_handle() -> Result<Handle>
[src]
pub fn current_in_handle() -> Result<Handle>
[src]Get the handle of the console input buffer.
This function uses CONIN$
to create a file handle to the current input buffer.
This wraps
CreateFileW
.
pub fn output_handle() -> Result<Handle>
[src]
pub fn output_handle() -> Result<Handle>
[src]Get the handle of the standard output.
On success this function returns the HANDLE
to STD_OUTPUT_HANDLE
.
This wraps GetStdHandle
called with STD_OUTPUT_HANDLE
.
pub fn input_handle() -> Result<Handle>
[src]
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
.
This wraps GetStdHandle
called with STD_INPUT_HANDLE
.
pub fn is_valid_handle(handle: &HANDLE) -> bool
[src]
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
Auto Trait Implementations
impl RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl UnwindSafe for Handle
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more