Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

Bindings for values that can be on-stack or refcounted #26

Open
mzabaluev opened this issue Oct 5, 2015 · 2 comments
Open

Bindings for values that can be on-stack or refcounted #26

mzabaluev opened this issue Oct 5, 2015 · 2 comments
Labels

Comments

@mzabaluev
Copy link
Member

There are GLib types: GVariantBuilder, GVariantDict, and GVariantIter, that can be heap-allocated and then refcounted, or be created on stack which naturally does not allow refcounting.
Bindings for each of these would likely require three different types:

  • an on-stack type, calling on-stack cleanup in Drop;
  • a type implementing Refcount to represent heap-allocated structures;
  • a type that implements most of the bound methods, with an AsRef-style conversion from the two types described above.
@gkoz
Copy link

gkoz commented Oct 5, 2015

What would be the point of creating those on the stack?

@mzabaluev
Copy link
Member Author

What would be the point of creating those on the stack?

Performance, I guess. These structures are mostly used in the local scope, to build or iterate over a GVariant.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants