Skip to content

Commit

Permalink
WindowHandle::clone fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ecton committed Sep 11, 2024
1 parent 7d2d0da commit 0401345
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- `Window` now calls winit's `pre_present_notify()` before presenting the
surface.
- `WindowHandle`'s `Clone` implementation no longer requires its generic
parameter to implement `Clone`.

### Added

Expand Down
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,7 @@ where
/// A handle to a window.
///
/// This handle does not prevent the window from being closed.
#[derive(Debug, Clone)]
#[derive(Debug)]
pub struct WindowHandle<Message = ()>(appit::Window<Message>);

impl<Message> WindowHandle<Message> {
Expand All @@ -1783,3 +1783,9 @@ impl<Message> WindowHandle<Message> {
self.0.send(message)
}
}

impl<Message> Clone for WindowHandle<Message> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}
2 changes: 1 addition & 1 deletion src/sprite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl Sprite {
let key = frame.key.decode_if_needed();
let name = key.split('.').next().assert_expected();
// Split by _ or ' 'as per the documentation of this method.
let name_parts = name.split(|c| c == '_' || c == ' ').collect::<Vec<_>>();
let name_parts = name.split(['_', ' ']).collect::<Vec<_>>();
let frame_number = name_parts[name_parts.len() - 1]
.parse::<usize>()
.or_else(|_| {
Expand Down

0 comments on commit 0401345

Please sign in to comment.