mirror of
https://github.com/danbulant/appit
synced 2026-06-20 14:51:30 +00:00
Relaxed Sized restrictions on App parameters
This commit is contained in:
parent
f5b8c8cf8b
commit
0fa6a4b3a5
2 changed files with 15 additions and 5 deletions
|
|
@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- All `&Appplication` bounds now are `?Sized`, enabling `&dyn Application`
|
||||||
|
parameters.
|
||||||
|
|
||||||
## v0.2.0 (2023-12-27)
|
## v0.2.0 (2023-12-27)
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ pub struct WindowBuilder<'a, Behavior, Application, AppMessage>
|
||||||
where
|
where
|
||||||
Behavior: self::WindowBehavior<AppMessage>,
|
Behavior: self::WindowBehavior<AppMessage>,
|
||||||
AppMessage: Message,
|
AppMessage: Message,
|
||||||
|
Application: ?Sized,
|
||||||
{
|
{
|
||||||
owner: &'a Application,
|
owner: &'a Application,
|
||||||
context: Behavior::Context,
|
context: Behavior::Context,
|
||||||
|
|
@ -76,6 +77,7 @@ impl<'a, Behavior, Application, AppMessage> Deref
|
||||||
where
|
where
|
||||||
Behavior: self::WindowBehavior<AppMessage>,
|
Behavior: self::WindowBehavior<AppMessage>,
|
||||||
AppMessage: Message,
|
AppMessage: Message,
|
||||||
|
Application: ?Sized,
|
||||||
{
|
{
|
||||||
type Target = WindowAttributes;
|
type Target = WindowAttributes;
|
||||||
|
|
||||||
|
|
@ -89,6 +91,7 @@ impl<'a, Behavior, Application, AppMessage> DerefMut
|
||||||
where
|
where
|
||||||
Behavior: self::WindowBehavior<AppMessage>,
|
Behavior: self::WindowBehavior<AppMessage>,
|
||||||
AppMessage: Message,
|
AppMessage: Message,
|
||||||
|
Application: ?Sized,
|
||||||
{
|
{
|
||||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||||
&mut self.attributes
|
&mut self.attributes
|
||||||
|
|
@ -181,7 +184,7 @@ impl Default for WindowAttributes {
|
||||||
impl<'a, Behavior, Application, AppMessage> WindowBuilder<'a, Behavior, Application, AppMessage>
|
impl<'a, Behavior, Application, AppMessage> WindowBuilder<'a, Behavior, Application, AppMessage>
|
||||||
where
|
where
|
||||||
Behavior: self::WindowBehavior<AppMessage>,
|
Behavior: self::WindowBehavior<AppMessage>,
|
||||||
Application: crate::AsApplication<AppMessage>,
|
Application: crate::AsApplication<AppMessage> + ?Sized,
|
||||||
AppMessage: Message,
|
AppMessage: Message,
|
||||||
{
|
{
|
||||||
pub(crate) fn new(owner: &'a Application, context: Behavior::Context) -> Self {
|
pub(crate) fn new(owner: &'a Application, context: Behavior::Context) -> Self {
|
||||||
|
|
@ -773,7 +776,7 @@ where
|
||||||
/// initialized, a default [`Context`](Self::Context) will be passed.
|
/// initialized, a default [`Context`](Self::Context) will be passed.
|
||||||
fn build<App>(app: &App) -> WindowBuilder<'_, Self, App, AppMessage>
|
fn build<App>(app: &App) -> WindowBuilder<'_, Self, App, AppMessage>
|
||||||
where
|
where
|
||||||
App: AsApplication<AppMessage>,
|
App: AsApplication<AppMessage> + ?Sized,
|
||||||
Self::Context: Default,
|
Self::Context: Default,
|
||||||
{
|
{
|
||||||
Self::build_with(app, <Self::Context as Default>::default())
|
Self::build_with(app, <Self::Context as Default>::default())
|
||||||
|
|
@ -786,7 +789,7 @@ where
|
||||||
context: Self::Context,
|
context: Self::Context,
|
||||||
) -> WindowBuilder<'_, Self, App, AppMessage>
|
) -> WindowBuilder<'_, Self, App, AppMessage>
|
||||||
where
|
where
|
||||||
App: AsApplication<AppMessage>,
|
App: AsApplication<AppMessage> + ?Sized,
|
||||||
{
|
{
|
||||||
WindowBuilder::new(app, context)
|
WindowBuilder::new(app, context)
|
||||||
}
|
}
|
||||||
|
|
@ -852,7 +855,7 @@ where
|
||||||
/// [`winit::window::WindowBuilder::build`].
|
/// [`winit::window::WindowBuilder::build`].
|
||||||
fn open<App>(app: &App) -> Result<Option<Window<AppMessage::Window>>, OsError>
|
fn open<App>(app: &App) -> Result<Option<Window<AppMessage::Window>>, OsError>
|
||||||
where
|
where
|
||||||
App: AsApplication<AppMessage>,
|
App: AsApplication<AppMessage> + ?Sized,
|
||||||
Self::Context: Default,
|
Self::Context: Default,
|
||||||
{
|
{
|
||||||
Self::build(app).open()
|
Self::build(app).open()
|
||||||
|
|
@ -873,7 +876,7 @@ where
|
||||||
context: Self::Context,
|
context: Self::Context,
|
||||||
) -> Result<Option<Window<AppMessage::Window>>, OsError>
|
) -> Result<Option<Window<AppMessage::Window>>, OsError>
|
||||||
where
|
where
|
||||||
App: AsApplication<AppMessage>,
|
App: AsApplication<AppMessage> + ?Sized,
|
||||||
{
|
{
|
||||||
Self::build_with(app, context).open()
|
Self::build_with(app, context).open()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue