Skip to content

Add new FromGlibPtrBorrow2 and FromGlibPtrBorrowMut2 traits#1788

Open
sdroege wants to merge 1 commit intogtk-rs:mainfrom
sdroege:from-glib-borrow-2
Open

Add new FromGlibPtrBorrow2 and FromGlibPtrBorrowMut2 traits#1788
sdroege wants to merge 1 commit intogtk-rs:mainfrom
sdroege:from-glib-borrow-2

Conversation

@sdroege
Copy link
Member

@sdroege sdroege commented Aug 12, 2025

These borrow more safely the underlying type and are supposed to replace the old FromGlibPtrBorrow trait once all users are gone, as well as the manual implementations for the trait functions which are deprecated now.

@sdroege sdroege requested a review from bilelmoussaoui August 12, 2025 15:18
///
/// For more information, refer to module level documentation.
// FIXME: Rename to FromGlibPtrBorrow once all users are gone
pub trait FromGlibPtrBorrow2<P>: Sized {
Copy link
Member Author

@sdroege sdroege Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also implement this for &str, &GStr, &GStrPtr, &StrVRef and various other types. Also boxed derive etc.

@sdroege sdroege force-pushed the from-glib-borrow-2 branch from 669a3da to d9c876d Compare August 12, 2025 15:20
These borrow more safely the underlying type and are supposed to replace
the old FromGlibPtrBorrow trait once all users are gone, as well as the
manual implementations for the trait functions which are deprecated now.
@sdroege sdroege force-pushed the from-glib-borrow-2 branch from d9c876d to cee787a Compare August 19, 2025 10:47
@bilelmoussaoui
Copy link
Member

I would just do the switch now, given that our next release if going to be a major one. So we can update all the bindings at once.

@sdroege
Copy link
Member Author

sdroege commented Dec 14, 2025

I'm not sure yet if I really want this as part of this release. It requires quite a bit of generator changes, so maybe should wait until the new one is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants