Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

glib: glib-macros: add SharedType and Shared derive macro #452

Merged
merged 3 commits into from
Apr 16, 2021

Conversation

mbiggio
Copy link

@mbiggio mbiggio commented Apr 14, 2021

Added a SharedType trait that allows implementing reference-counted
types in terms os std::sync::Arc. In particular, the ffi methods that
increment reference counting can return always the same pointer value.
Also, added a Shared derive macro, similar to the existing GBoxed
one, that simplifies the creation of Shared objects.

Copy link
Member

@sdroege sdroege left a comment

Choose a reason for hiding this comment

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

Looks nice apart from that, thanks! :)

@sdroege sdroege added this to the 0.14.0 milestone Apr 14, 2021
@mbiggio mbiggio force-pushed the wip/biggio/shared-macro branch from 36e0256 to 5e4a39e Compare April 14, 2021 17:54
Copy link
Member

@sdroege sdroege left a comment

Choose a reason for hiding this comment

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

Apart from the open comments this seems ready to me now

@mbiggio mbiggio force-pushed the wip/biggio/shared-macro branch from 5e4a39e to 1bb1375 Compare April 15, 2021 00:06
@mbiggio mbiggio force-pushed the wip/biggio/shared-macro branch from 1bb1375 to d80d888 Compare April 15, 2021 11:23
@sdroege
Copy link
Member

sdroege commented Apr 15, 2021

Let me know when the above discussions are all resolved and this is ready for a final review :)

@mbiggio mbiggio force-pushed the wip/biggio/shared-macro branch from d80d888 to b9f423a Compare April 15, 2021 12:16
@sdroege
Copy link
Member

sdroege commented Apr 15, 2021

@GuillaumeGomez @bilelmoussaoui What do you think?

@pbor
Copy link
Contributor

pbor commented Apr 15, 2021

Should glib-macros/src/shared_derive.rs be renamed to glib-macros/src/gboxed_shared_derive.rs ?

@sdroege
Copy link
Member

sdroege commented Apr 15, 2021

Should glib-macros/src/shared_derive.rs be renamed to glib-macros/src/gboxed_shared_derive.rs ?

That would make sense, good point!

Matteo Biggio added 3 commits April 16, 2021 10:40
Added a SharedType trait that allows implementing reference-counted
types in terms os std::sync::Arc. In particular, the ffi methods that
increment reference counting can return always the same pointer value.
Also, added a `Shared` derive macro, similar to the existing `GBoxed`
one, that simplifies the creation of Shared objects.
@mbiggio mbiggio force-pushed the wip/biggio/shared-macro branch from a282058 to 3c24a50 Compare April 16, 2021 08:42
Copy link
Member

@bilelmoussaoui bilelmoussaoui left a comment

Choose a reason for hiding this comment

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

Looks good to me, the name still seems a bit weird. Although, I don't think we can do any better if we want to keep the Boxed reference.

@sdroege sdroege merged commit fb54c7f into gtk-rs:master Apr 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for refcounted types to GBoxed derive macro or add a new macro
5 participants