2019-01-28 07:16:14 +11:00
|
|
|
use crossterm_winapi::{Handle, HandleType};
|
|
|
|
|
2019-09-16 04:42:12 +10:00
|
|
|
#[allow(unused_variables)]
|
2019-01-28 07:16:14 +11:00
|
|
|
fn main() {
|
2019-09-16 04:42:12 +10:00
|
|
|
// see the description of the types to see what they do.
|
2019-01-28 07:16:14 +11:00
|
|
|
let out_put_handle = Handle::new(HandleType::OutputHandle).unwrap();
|
|
|
|
let out_put_handle = Handle::new(HandleType::InputHandle).unwrap();
|
|
|
|
let curr_out_put_handle = Handle::new(HandleType::CurrentOutputHandle).unwrap();
|
|
|
|
let curr_out_put_handle = Handle::new(HandleType::CurrentInputHandle).unwrap();
|
|
|
|
|
|
|
|
// now you have this handle you might want to get the WinApi `HANDLE` it is wrapping.
|
|
|
|
// you can do this by defencing.
|
|
|
|
|
|
|
|
let handle /*:HANDLE*/ = *out_put_handle;
|
|
|
|
|
|
|
|
// you can also pass you own `HANDLE` to create an instance of `Handle`
|
|
|
|
let handle = Handle::from(handle); /* winapi::um::winnt::HANDLE */
|
|
|
|
}
|