chore: Housekeeping

- Update CHANGELOG
- Add documentation to items I forgot to document
- Trait implementations

Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
John Nunley
2024-02-04 15:53:34 -08:00
parent c6e57430bb
commit daf1304879
8 changed files with 39 additions and 12 deletions

View File

@@ -21,9 +21,12 @@ serde = ["dep:serde", "cursor-icon/serde", "smol_str/serde"]
[dependencies]
bitflags.workspace = true
cursor-icon.workspace = true
mint = { version = "0.5.6", optional = true }
serde = { workspace = true, optional = true }
smol_str.workspace = true
web-time = "1"
[target.'cfg(target_family = "wasm")'.dependencies]
web-time.workspace = true
[build-dependencies]
cfg_aliases = "0.2.0"
cfg_aliases.workspace = true

View File

@@ -14,6 +14,9 @@ use std::time::Instant;
#[cfg(web_platform)]
use web_time::Instant;
#[cfg(feature = "serde")]
pub use serde::{Serialize, Deserialize};
use smol_str::SmolStr;
/// Identifier of an input device.
@@ -778,6 +781,7 @@ pub struct Modifiers {
}
impl Modifiers {
/// Only `winit` should instantiate this!
#[doc(hidden)]
pub fn new(state: ModifiersState, pressed_mods: ModifiersKeys) -> Self {
Self {
@@ -1120,6 +1124,7 @@ impl InnerSizeWriter {
}
}
/// Get the underlying size.
pub fn get(&self) -> PhysicalSize<u32> {
*self.new_inner_size.upgrade().unwrap().lock().unwrap()
}

View File

@@ -3,6 +3,9 @@
#[doc(inline)]
pub use cursor_icon::{CursorIcon, ParseError as CursorIconParseError};
#[cfg(feature = "serde")]
pub use serde::{Serialize, Deserialize};
/// Identifier of a window. Unique for each window.
///
/// Can be obtained with [`window.id()`](`Window::id`).
@@ -192,7 +195,7 @@ impl Default for ImePurpose {
}
}
/// An opaque token used to activate the [`Window`].
/// An stringly-typed token used to activate the [`Window`].
///
/// [`Window`]: crate::window::Window
#[derive(Debug, PartialEq, Eq, Clone)]
@@ -201,14 +204,17 @@ pub struct ActivationToken {
}
impl ActivationToken {
pub fn new(_token: String) -> Self {
Self { token: _token }
/// Create a new [`ActivationToken`].
pub fn new(token: String) -> Self {
Self { token }
}
/// Get the underlying token.
pub fn token(&self) -> &str {
&self.token
}
/// Convert into the underlying token.
pub fn into_token(self) -> String {
self.token
}