Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional type bounds to Impl traits #1854

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- stable
- beta
- nightly
- "1.70"
- "1.80"
conf:
- {
name: "gtk4",
Expand Down Expand Up @@ -118,8 +118,8 @@ jobs:
cargo-deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v2
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v2

regen_check:
name: regen checker
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.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ edition = "2021"
homepage = "https://gtk-rs.org/gtk4-rs"
license = "MIT"
repository = "https://github.com/gtk-rs/gtk4-rs"
rust-version = "1.70"
rust-version = "1.80"
version = "0.10.0"

[workspace.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ For more information about each crate, please refer to their `README.md` file in

## Minimum supported Rust version

Currently, the minimum supported Rust version is `1.70`.
Currently, the minimum supported Rust version is `1.80`.

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion examples/virtual_methods/base_button/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<O: IsA<BaseButton>> BaseButtonExt for O {}
/// implement.
///
/// See `derived_button/imp.rs` for how to override virtual methods.
pub trait BaseButtonImpl: ButtonImpl {
pub trait BaseButtonImpl: ButtonImpl + ObjectSubclass<Type: IsA<BaseButton>> {
/// Default implementation of a virtual method.
///
/// This always calls into the implementation of the parent class so that if
Expand Down
2 changes: 1 addition & 1 deletion gdk4-wayland/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GDK Wayland contains functions specific to the Wayland backend.

## Minimum supported Rust version

Currently, the minimum supported Rust version is `1.70`.
Currently, the minimum supported Rust version is `1.80`.

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion gdk4-win32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GDK Win32 contains functions specific to the Win32 backend.

## Minimum supported Rust version

Currently, the minimum supported Rust version is `1.70`.
Currently, the minimum supported Rust version is `1.80`.

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion gdk4-x11/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GDK X11 contains functions specific to the X11 backend.

## Minimum supported Rust version

Currently, the minimum supported Rust version is `1.70`.
Currently, the minimum supported Rust version is `1.80`.

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion gdk4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ of [gtk4-rs](https://github.com/gtk-rs/gtk4-rs/).

## Minimum supported Rust version

Currently, the minimum supported Rust version is `1.70`.
Currently, the minimum supported Rust version is `1.80`.

## Documentation

Expand Down
9 changes: 2 additions & 7 deletions gdk4/src/subclass/content_provider.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file.

// rustdoc-stripper-ignore-next
//! Traits intended for subclassing [`ContentProvider`](crate::ContentProvider).

Check warning on line 4 in gdk4/src/subclass/content_provider.rs

View workflow job for this annotation

GitHub Actions / build

redundant explicit link target

Check warning on line 4 in gdk4/src/subclass/content_provider.rs

View workflow job for this annotation

GitHub Actions / build

redundant explicit link target

use std::{future::Future, pin::Pin};

Expand All @@ -9,7 +9,7 @@

use crate::{ffi, prelude::*, subclass::prelude::*, Clipboard, ContentFormats, ContentProvider};

pub trait ContentProviderImpl: ContentProviderImplExt + ObjectImpl {
pub trait ContentProviderImpl: ObjectImpl + ObjectSubclass<Type: IsA<ContentProvider>> {
fn content_changed(&self) {
self.parent_content_changed()
}
Expand Down Expand Up @@ -44,12 +44,7 @@
}
}

mod sealed {
pub trait Sealed {}
impl<T: super::ContentProviderImplExt> Sealed for T {}
}

pub trait ContentProviderImplExt: sealed::Sealed + ObjectSubclass {
pub trait ContentProviderImplExt: ContentProviderImpl {
fn parent_content_changed(&self) {
unsafe {
let data = Self::type_data();
Expand Down
9 changes: 2 additions & 7 deletions gdk4/src/subclass/paintable.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Take a look at the license at the top of the repository in the LICENSE file.

// rustdoc-stripper-ignore-next
//! Traits intended for implementing the [`Paintable`](crate::Paintable)

Check warning on line 4 in gdk4/src/subclass/paintable.rs

View workflow job for this annotation

GitHub Actions / build

redundant explicit link target

Check warning on line 4 in gdk4/src/subclass/paintable.rs

View workflow job for this annotation

GitHub Actions / build

redundant explicit link target
//! interface.

use glib::translate::*;

use crate::{ffi, prelude::*, subclass::prelude::*, Paintable, PaintableFlags, Snapshot};

pub trait PaintableImpl: PaintableImplExt + ObjectImpl {
pub trait PaintableImpl: ObjectImpl + ObjectSubclass<Type: IsA<Paintable>> {
#[doc(alias = "get_current_image")]
fn current_image(&self) -> Paintable {
self.parent_current_image()
Expand Down Expand Up @@ -37,12 +37,7 @@
fn snapshot(&self, snapshot: &Snapshot, width: f64, height: f64);
}

mod sealed {
pub trait Sealed {}
impl<T: super::PaintableImplExt> Sealed for T {}
}

pub trait PaintableImplExt: sealed::Sealed + ObjectSubclass {
pub trait PaintableImplExt: PaintableImpl {
fn parent_current_image(&self) -> Paintable {
unsafe {
let type_data = Self::type_data();
Expand Down
2 changes: 1 addition & 1 deletion gsk4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Vulkan implementation.

## Minimum supported Rust version

Currently, the minimum supported Rust version is `1.70`.
Currently, the minimum supported Rust version is `1.80`.

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion gtk4-macros/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Macro helpers for GTK 4 bindings, part of [gtk4-rs](https://github.com/gtk-rs/gt

## Minimum supported Rust version

Currently, the minimum supported Rust version is `1.70`.
Currently, the minimum supported Rust version is `1.80`.

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion gtk4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ See also:

## Minimum supported Rust version

Currently, the minimum supported Rust version is `1.70`.
Currently, the minimum supported Rust version is `1.80`.

## "Hello, World!" example program

Expand Down
9 changes: 2 additions & 7 deletions gtk4/src/subclass/accessible.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
ffi, prelude::*, subclass::prelude::*, ATContext, Accessible, AccessiblePlatformState,
};

pub trait AccessibleImpl: ObjectImpl {
pub trait AccessibleImpl: ObjectImpl + ObjectSubclass<Type: IsA<Accessible>> {
#[doc(alias = "get_platform_state")]
fn platform_state(&self, state: AccessiblePlatformState) -> bool {
self.parent_platform_state(state)
Expand Down Expand Up @@ -44,12 +44,7 @@ pub trait AccessibleImpl: ObjectImpl {
}
}

mod sealed {
pub trait Sealed {}
impl<T: super::AccessibleImplExt> Sealed for T {}
}

pub trait AccessibleImplExt: sealed::Sealed + ObjectSubclass {
pub trait AccessibleImplExt: AccessibleImpl {
fn parent_platform_state(&self, state: AccessiblePlatformState) -> bool {
unsafe {
let type_data = Self::type_data();
Expand Down
9 changes: 2 additions & 7 deletions gtk4/src/subclass/accessible_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@ use glib::translate::*;

use crate::{ffi, prelude::*, subclass::prelude::*, AccessibleRange};

pub trait AccessibleRangeImpl: WidgetImpl {
pub trait AccessibleRangeImpl: AccessibleImpl + ObjectSubclass<Type: IsA<AccessibleRange>> {
fn set_current_value(&self, value: f64) -> bool {
self.parent_set_current_value(value)
}
}

mod sealed {
pub trait Sealed {}
impl<T: super::AccessibleRangeImplExt> Sealed for T {}
}

pub trait AccessibleRangeImplExt: sealed::Sealed + ObjectSubclass {
pub trait AccessibleRangeImplExt: AccessibleRangeImpl {
// Returns true if the operation was performed, false otherwise
fn parent_set_current_value(&self, value: f64) -> bool {
unsafe {
Expand Down
9 changes: 2 additions & 7 deletions gtk4/src/subclass/actionable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use glib::{translate::*, GString, Variant};

use crate::{ffi, prelude::*, subclass::prelude::*, Actionable};

pub trait ActionableImpl: WidgetImpl {
pub trait ActionableImpl: WidgetImpl + ObjectSubclass<Type: IsA<Actionable>> {
#[doc(alias = "get_action_name")]
fn action_name(&self) -> Option<GString>;
#[doc(alias = "get_action_target_value")]
Expand All @@ -17,12 +17,7 @@ pub trait ActionableImpl: WidgetImpl {
fn set_action_target_value(&self, value: Option<&Variant>);
}

mod sealed {
pub trait Sealed {}
impl<T: super::ActionableImplExt> Sealed for T {}
}

pub trait ActionableImplExt: sealed::Sealed + ObjectSubclass {
pub trait ActionableImplExt: ActionableImpl {
fn parent_action_name(&self) -> Option<GString> {
unsafe {
let type_data = Self::type_data();
Expand Down
9 changes: 2 additions & 7 deletions gtk4/src/subclass/adjustment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use glib::translate::*;

use crate::{ffi, prelude::*, subclass::prelude::*, Adjustment};

pub trait AdjustmentImpl: AdjustmentImplExt + ObjectImpl {
pub trait AdjustmentImpl: ObjectImpl + ObjectSubclass<Type: IsA<Adjustment>> {
fn changed(&self) {
self.parent_changed()
}
Expand All @@ -17,12 +17,7 @@ pub trait AdjustmentImpl: AdjustmentImplExt + ObjectImpl {
}
}

mod sealed {
pub trait Sealed {}
impl<T: super::AdjustmentImplExt> Sealed for T {}
}

pub trait AdjustmentImplExt: sealed::Sealed + ObjectSubclass {
pub trait AdjustmentImplExt: AdjustmentImpl {
fn parent_changed(&self) {
unsafe {
let data = Self::type_data();
Expand Down
Loading
Loading