witer/
lib.rs

1/*!
2  `witer` (window iterator, "wit-er") is an iterator-based Win32 window library built in Rust.
3
4  # Example
5
6  ```
7  use witer::prelude::*;
8
9  // Build
10  let window = Window::builder()
11    .with_title("My App")
12    .with_size(LogicalSize::new(800.0, 500.0))
13    .build()?;
14
15  // Run
16  for message in &window {
17    if let Message::Key { .. } = message {
18      println!("{message:?}");
19    }
20  }
21  # Ok::<(), witer::error::WindowError>(())
22  ```
23
24  Please note that the window will wait to process new messages until the end of each cycle of the loop, despite
25  being on a separate thread. This keeps the window in sync with the main thread to prevent things such as input
26  lag.
27*/
28
29#![cfg(any(target_os = "windows", doc))]
30#![deny(unsafe_op_in_unsafe_fn)]
31
32#[cfg(all(feature = "rwh_05", not(feature = "rwh_06")))]
33pub use rwh_05 as raw_window_handle;
34#[cfg(all(feature = "rwh_06", not(feature = "rwh_05")))]
35pub use rwh_06 as raw_window_handle;
36
37pub mod compat;
38pub mod error;
39pub mod prelude;
40pub mod utilities;
41pub mod window;
42
43// re-exports
44pub use window::{
45  data::{
46    CursorMode,
47    Flow,
48    Fullscreen,
49    LogicalPosition,
50    LogicalSize,
51    PhysicalPosition,
52    PhysicalSize,
53    Position,
54    Size,
55    Theme,
56    Visibility,
57  },
58  input::{
59    key::Key,
60    mouse::MouseButton,
61    state::{ButtonState, KeyState, RawKeyState},
62    Input,
63  },
64  message::{LoopMessage, Message, RawInputMessage},
65  settings::{WindowBuilder, WindowSettings},
66  Window,
67};
68
69#[cfg(doctest)]
70#[doc = include_str!("../README.md")]
71struct ReadMe;